+ Reply to Thread
Results 1 to 5 of 5

Thread: News vs Headlines

  1. Join Date
    May 2005
    Posts
    4

    News vs Headlines

    This is a cool script, but I have a question - what is the difference between display_News and display_Headlines?

    I've tried both and understand display_News, but display_Headlines does nothing.

    Thanks,
    Brian

  2. Join Date
    Aug 2004
    Posts
    781

    News vs Headlines

    Actually, display headlines displays headlines

    More specifically, it parses the news with the headlines template as opposed to the news template. If you are not receiving any output, then your headlines template is likely blank. Click on "Edit Templates" in the menu and edit the Headlines template (the top box). The default is:

    Code:
    · <a href="!!NEWS_URL!!">!!TITLE!!</a><br>

    The other difference is probably one your would not notice. Within the script, it usually takes an extra MySQL query in order to fetch the actual news text. Therefore, if a person wanted to use headlines alone, it would be better to use the headlines generate code as opposed to modifying the post display of the template because the script can skip this extra query. Of course none of this matters if you are displaying BOTH headlines and news on the same page, as the queries are temporarily cached (both physically in files and dynamically in variables) and therefore repeat queries have no downside. Overall, it is just a bunch of optimization techniques that are used in order to speed up the script significantly.

    The second part is confusing I am sure. To summarize it: Using the headlines when text is not needed is a way of saving on unnecessary CPU usage extra time to load the page.

  3. Join Date
    May 2005
    Posts
    4

    News vs Headlines

    Thanks for the reply. Here is what I'm getting...

    With this code:
    Code:
    <?php include_once("/home/midtn/public_html/forum-news/news.php");
    $forum_obj = new EP_Dev_Forum_News();
    $forum_obj->display_News("1", "2", "0", "0"); ?>
    I get this result:

    Test
    This is a test.
    [read full story]
    Comments (0) - Posted on Sunday, May 1 @ 11:52 PM by admin

    I change the code to:
    Code:
    <?php include_once("/home/midtn/public_html/forum-news/news.php");
    $forum_obj = new EP_Dev_Forum_News();
    $forum_obj->display_Headlines("1", "2", "0", "0"); ?>
    And I get:

    No posts found in selected forum category.

    Reading the readme file, and your explanation tells me this should work - and I would prefer to display Headlines only.

    I was looking to edit the template to just display the headline, but I hope you can see what I'm doing wrong.

    Thanks,
    Brian

  4. Join Date
    Aug 2004
    Posts
    781

    News vs Headlines

    Hmm, I was looking through and it looks like there may be an error in the code. Apparently it isn't being picked up by PHP 5, but I am guessing that you have PHP 4.x.

    Open up news.php:

    Find:
    Code:
    $this->display_News($number=NULL, $ids=NULL, $forums=NULL, $template_id=0, true);
    and Replace with:
    Code:
    $this->display_News($number, $ids, $forums, $template_id, true);
    I will also release an update in the near future to correct the problem, but you can apply this fix for now.

  5. Join Date
    May 2005
    Posts
    4

    News vs Headlines

    That fixed it!

    Thanks so much for the help.

    Brian

+ Reply to Thread

Posting Permissions

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