View Full Version : rssbox changing time
drapet
10-03-2010, 11:33 PM
helo!
How can i change the time in rssbox script to display e.g.GMT+1?
Thanks!!!
bluewalrus
10-04-2010, 12:01 AM
What is the code you currently have?
drapet
10-04-2010, 05:17 AM
Sorry I'm new in these, i menage to change som oder stuff bat i cant finde this code to menage.
I have :outputbody.php
main.php
rssdisplaybox.js
virtualpaginate.js
which one you need to send you?
Thanks!!
bluewalrus
10-04-2010, 02:27 PM
I don't know, which ever relates to the time.
I assume outputbody.php displays the code so you code just do a simple conversion there but then any code that is being written else where, if any, would have the incorrect time still.
main.php probably does the actual work so I assume it would be in there, posting both would be the easiest.
drapet
10-04-2010, 05:15 PM
here is: outputbody.php
<?
//Function for ouputting the body of each RSS item displayed (inside loop)- DynamicDrive.com
//For syntax pf bpdu, see: http://simplepie.org/docs/installation/from-scratch/ and http://simplepie.org/docs/reference/
//Function by default defines 3 different body outputs (templates). Modify or add additional templates as desired
function outputbody($item, $template=""){
if ($template=="" || $template=="default"){ //DEFAULT TEMPLATE
?>
<DIV class="rsscontainer">
<div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></div>
<div class="rssdate"><?php echo $item->get_date('d M Y g:i a'); ?></div>
<div class="rssdescription"><?php echo $item->get_description(); ?></div>
</DIV>
<?
} //end default template
else if ($template=="titles"){ //"TITLES" TEMPLATE
?>
<DIV class="rsscontainer">
<div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>" target="_new"><?php echo $item->get_title(); ?></a></div>
<div>Category: <?php echo $item->get_category(); ?></div>
</DIV>
<?
} //end titles template
else if ($template=="titlesdates"){ //"TITLESDATES" TEMPLATE
?>
<DIV class="rsscontainer">
<span class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></span>
<span class="rssdate"><?php echo $item->get_date('m/d/y g:i a'); ?></span>
</DIV>
<?
} //end titlesdates template
else if ($template=="mytemplatename"){ //"mytemplatename" TEMPLATE
?>
//DEFINE ADDITIONAL CUSTOM TEMPLATE(s) USING SAME LOGIC STRUCTURE AS ABOVE
//For syntax of template body, see SimplePie docs: http://simplepie.org/docs/installation/from-scratch/ and http://simplepie.org/docs/reference/
<?
}
else
die ("No template exists with such name!");
} //Closing function bracket
?>
main.php
<?php
//Function for ouputting the body of each RSS item displayed (inside loop)- DynamicDrive.com
require('../simplepie/simplepie.inc'); //Specify path to simplepie.inc on your server (by default located inside "simplepie" directory)
$feed = new SimplePie();
$feed->cache_location('cache'); //Specify path to cache directory on your server relative to this file
$feed->handle_content_type();
require('outputbody.php'); //Path to custom "outputbody.php" file relative to this file
//Specify list of RSS URLs
$rsslist=array(
"cssdrive" => "http://www.cssdrive.com/index.php/news/rss_2.0/",
"bbc" => "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml",
"nytimes" => "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml",
"dynamicdrive" => "http://www.dynamicdrive.com/export.php?type=new" //no trailing comma after last RSS URL!!
);
////Beginners don't need to configure past here. Edit outputbody.php to format the output of each RSS item's body ////////////////////
$rssid=$_GET['id'];
$rssurl=isset($rsslist[$rssid])? $rsslist[$rssid] : die("<b>Error:</b> Can't find requested RSS in list.");
$cachetime=isset($_GET["cachetime"])? (int)$_GET["cachetime"] : 30; //Get cachetime. Default to 30 if not specified
$feednumber=isset($_GET["limit"])? (int)$_GET["limit"] : ""; //Get number of items to fetch. If not specified (""), all is fetched.
$templatename=isset($_GET["template"])? $_GET["template"] : ""; //get name of template, which is used by if/else logic within function outputbody()
if ($templatename!="" && !preg_match("/^(\w|-)+$/i", $templatename)) //Template name can only contain alphanumeric characters, underscore or dash (-)
die ("<b>Error:</b> Template name can only consist of alphanumeric characters, underscore or dash");
$feed->cache_max_minutes($cachetime);
$feed->feed_url($rssurl);
$feed->init();
$max = $feed->get_item_quantity($feednumber);
function outputitems(){
global $feed, $feednumber, $templatename;
$max = $feed->get_item_quantity($feednumber);
for ($x = 0; $x < $max; $x++){
$item = $feed->get_item($x);
outputbody($item, $templatename); //call custom outputbody() function
}
}
?>
<?php
if ($feed->data){
outputitems();
}
bluewalrus
10-04-2010, 05:36 PM
In output.php you can set your time zone
Pick out your timezone here http://us.php.net/manual/en/timezones.php
Then add this before your date callings in the output.php.
$timezone = "name from list";
date_default_timezone_set($timezone);
drapet
10-05-2010, 05:06 AM
thanks a lot
it work like this
<div class="rssdate"><?php echo $item->get_date ('d M Y g:i a'); $timezone = "name from list";
date_default_timezone_set($timezone); ?></div>
i have another question for you, if I dont bother you,
can I put 2 or 3 feed adress in one box?
thanks in advance
bluewalrus
10-05-2010, 01:20 PM
Yes, do you have a link to where I can see the script working either on DD or on your site?
drapet
10-06-2010, 03:11 AM
dd (http://www.dynamicdrive.com/dynamicindex18/rssdisplaybox/index.htm)
or
my site (http://sveizfotelje.com/demo.htm)
bluewalrus
10-07-2010, 01:52 AM
It'll take a bit of coding you'll have to pull out the div's in the output.php so it only output's the rss content and then where that is being passed to you'll need to have a conditional that counts the feeds and at the set number closes the container and starts another. The last part is javascript driven I think and beyond my knowledge. I'd try posting the question here: http://www.dynamicdrive.com/forums/newthread.php?do=newthread&f=2
Be sure to include a link to the dd page and your page.
drapet
10-07-2010, 03:28 AM
thank you very much
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.