PDA

View Full Version : News vs Headlines



bezzell
05-02-2005, 08:40 PM
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

Patrick
05-02-2005, 08:56 PM
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:


· <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.

bezzell
05-02-2005, 10:36 PM
Thanks for the reply. Here is what I'm getting...

With this 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:

<?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

Patrick
05-03-2005, 05:20 PM
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:

$this->display_News($number=NULL, $ids=NULL, $forums=NULL, $template_id=0, true);

and Replace with:

$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.

bezzell
05-03-2005, 08:09 PM
That fixed it!

Thanks so much for the help.

Brian