Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: rssbox changing time

  1. #1
    Join Date
    Oct 2010
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default rssbox changing time

    helo!

    How can i change the time in rssbox script to display e.g.GMT+1?

    Thanks!!!

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    What is the code you currently have?
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Oct 2010
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Sorry I'm new in these, i menage to change som oder stuff bat i cant finde this code to menage.

    I have utputbody.php
    main.php
    rssdisplaybox.js
    virtualpaginate.js

    which one you need to send you?

    Thanks!!

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    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.
    Corrections to my coding/thoughts welcome.

  5. #5
    Join Date
    Oct 2010
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    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();
    }

  6. #6
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    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.
    PHP Code:
    $timezone "name from list";
    date_default_timezone_set($timezone); 
    Corrections to my coding/thoughts welcome.

  7. The Following User Says Thank You to bluewalrus For This Useful Post:

    drapet (10-05-2010)

  8. #7
    Join Date
    Oct 2010
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    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

  9. #8
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Yes, do you have a link to where I can see the script working either on DD or on your site?
    Corrections to my coding/thoughts welcome.

  10. #9
    Join Date
    Oct 2010
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    dd
    or
    my site

  11. #10
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    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/n...=newthread&f=2

    Be sure to include a link to the dd page and your page.
    Corrections to my coding/thoughts welcome.

  12. The Following User Says Thank You to bluewalrus For This Useful Post:

    drapet (10-07-2010)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •