Subject: Convert your index page to Headlines

Posted on: 14/10/02 08:50pm
By: knuckles

First, a big thanks to Mark Limburg who helped code this up for me in under ten minutes. It is now saved to CVS but you can do the changes in under 5 minutes yourself.What this does is allow you to have two storytext templates. One for the home page and one that displays the entire story when the user clicks "Read More". Well, there won't be a read more link anymore because the actual headline will become the link.

So, here are Mark's instructions:

1. firstly, you do need to create a new template .. so frontstorytext.thtml is fine

2. next, open lib-common.php

3. search for 'function COM_article('

4. update that line to read: function COM_article( $A, $index='', $tpl='storytext.thtml' )

5. search underneath that for a line that contains: 'article'=>'storytext.thtml',

6. change that to: 'article'=> $tpl,

7. then save lib-common.php and close it

8. then, open index.php (this part is not in CVS)

9. find: $display .= COM_article($A,'y');

10. replace with: $display .= COM_article( $A, 'y', 'frontstorytext.thtml' );

11. save, and you're good to go

12. simple hack actually, and it won't break anything else

13. Lastly, in your frontstorytext.thtml file, replace {story_title} with
<a href="{site_url}/article.php?story={story_id}">{story_title}</a>
The idea here is that this thtml file only contains the headline, if this is the case then your headline has to have a link since the "Read More" link is no longer there.

This is what my frontstorytext.thtml looks like:

<table width="100%" border="0" cellspacing="0" cellpadding="2">
	<tr>
		<td colspan="2" align="left" bgcolor="#e1e2e5"><span class="articleTitle"><a href="{site_url}/article.php?story={story_id}">{story_title}</a></span></td>
	</td>
	</tr>
</table>


I'd like to thank Dirk for sending that last bit of code to get the headline link to actually work!


knuckles

Convert your index page to Headlines

Posted on: 15/10/02 01:26am
By: robinbowes

Hi, I like the concept of this idea - it makes the front page look much slicker. Here's a few ideas to take it further: What about featured articles? They currently still display normally. I'd like to see a heading above the list of headlines "Latest Stories" or "Latest Headlines" or whatever. I had a look at index.php but couldn't work out where to put any code because of the Featured Article issue. Presumably, any article can be featured, not just the first one? Any ideas? Cheers, R.

An example please

Posted on: 15/10/02 05:47am
By: Anonymous

Where is a site that uses this we can look at?

Ditto..Would Like an Example

Posted on: 19/10/02 09:00am
By: Anonymous

Would love to see what you're talking about. Thank you very much.NVR

Convert your index page to Headlines

Posted on: 14/11/02 04:08pm
By: knuckles

ssss

Convert your index page to Headlines

Posted on: 04/12/02 09:37am
By: jimphelps

Same concept but only for one section

I would like the same feature (like Squatty.com) where there is a list of headlines at the top of the page with links to the articles below. This would be for a FAQ section of my site. I only want this type of listing to appear for this section (or selected sections).

Any ideas?

Thanks for great software.

Convert your index page to Headlines

Posted on: 22/03/03 11:41pm
By: elf

Afew questions: 1) Do I have to create the frontstorytext.thtml file? 2) Does it have to be named that? 3) Where do I put it/where is it found if it already exists? Thanks alot to anyone who can help.

Convert your index page to Headlines

Posted on: 07/07/04 09:56am
By: Norgs

Hey guys,

Did a working example of this ever turn up?

Thanks

Convert your index page to Headlines

Posted on: 13/07/04 11:54pm
By: varian vega

Hi Knuckles,

thanks for this piece of code! I actually used it for a little different reason, but it works fine for me.

What I did was only copy the storytext.thtml to frontstorytext.thtml and added some extra code, so that the short articles on the front page are highlighted and linked entirely to the whole article (I know not everybody will like that but this is a netradio site). With your extra code it prevents the article view to be highlighted, too (and linked to nowwhere...)

In action: www.infectedradio.com

To get the point for those asking: With this code you can change the look of articles in frontpage / topicview to sth entirely different than the article view - e.g. to only headlines like knuckles mentioned etc.

@ elf:
1) yes, you have to create this file yourself, you can copy storytext.thtml (like i did) and change it to your needs.
2) no, it shure does not have to, but then change its name in lib-common.php and index.php, too

Bye, varian

Convert your index page to Headlines

Posted on: 01/10/04 08:23am
By: thedailycynic

Does this hack work with 1.3.9 1 . i tried to get the code to work but it really jacks everything up. Am i doing something wrong or is this just too old for the newest version of GL?

Convert your index page to Headlines

Posted on: 03/05/05 06:56am
By: jason559

How can I get this to work with the current version of geeklog?

Convert your index page to Headlines

Posted on: 08/05/05 10:20am
By: ofey

I think this is a brilliant hack and really want to implement it.
I'm using GL 1.3.11 I can't find 'function COM_article' in lib-common.php. I did a search of this file using
awk '/function COM_article/' lib-common.php
But nothing.
As Jason559 above said,
How can I get this to work with the current version of geeklog?


Regards,

Ofey

Convert your index page to Headlines

Posted on: 08/05/05 02:23pm
By: Anonymous

COM_article has been renamed STORY_renderArticle and moved to lib-story.php.

Geeklog fully implements this now so you only need the new template file and a quick edit of those function calls in the index.php.

Convert your index page to Headlines

Posted on: 08/05/05 04:39pm
By: ofey

Anyone know why in step 13. it says '...replace...'
Wouldn't frontstorytext.thtml be empty to start with?
And thanks Mach, that makes much more sense.

I think I've done everything, but no changes on the site. The read more link is still there. There seems to be only two things to do, which I did do,

1. Created a new template file frontstorytext.thtml and put it in .../layout/gameserver/ which is in my public directory. It's empty except for the the following,

&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot;&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot; bgcolor=&quot;#e1e2e5&quot;&gt;&lt;span class=&quot;articleTitle&quot;&gt;&lt;a href=&quot;{site_url}/article.php?story={story_id}&quot;&gt;{story_title}&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

2. Changed the appropiate lines in index so it now reads,

$display .= STORY_renderArticle ($A, 'y', 'frontstorytext.thtml' );

// get plugin center blocks after featured article
if ($A['featured'] == 1) {
$display .= PLG_showCenterblock (2, $page, $topic);
}

// get reamaining stories
while ( $A = DB_fetchArray($result) ) {
$display.= STORY_renderArticle ($A, 'y', 'frontstorytext.thtml' );

So what you think folks?


Convert your index page to Headlines

Posted on: 08/05/05 05:32pm
By: machinari

[QUOTE BY= ofey] Anyone know why in step 13. it says '...replace...'
Wouldn't frontstorytext.thtml be empty to start with?
[/QUOTE]
it says that because usually a person would start with a copy of storytext.thtml and just rename that copy. This is actually a good practice as most of the typical template variables are listed there and you wouldn't have to go searching in STORY_renderArticle() to find which ones are available.

As for your changes not being reflected in your site... ensure that the template file name is consistant re. case and spelling, but more likely, because you suggest that the old template is still being used, it is a cache issue.

Convert your index page to Headlines

Posted on: 08/05/05 05:33pm
By: machinari

Also, check that you've properly uploaded the edited index.php to your server.

Convert your index page to Headlines

Posted on: 08/05/05 05:38pm
By: ofey

Hey Machinari,

When you say a cache issue, would that just be solved by deleting cookies and history? I did that and still no change.

My site.

Shane

I edited the above post, it has a bit more detail now which might explain where I'm going wrong.

Convert your index page to Headlines

Posted on: 08/05/05 05:38pm
By: machinari

[QUOTE BY= ofey] Created a new template file frontstorytext.thtml ...
[/QUOTE]
may I suggest that you do not use a table for your story titles if that is all you are going to display... perhaps just a heading tag. cleaner markup, and more search engine friendly.
don't mind me if I keep blithering away

Convert your index page to Headlines

Posted on: 08/05/05 05:42pm
By: machinari

[QUOTE BY= ofey] Hey Machinari,

When you say a cache issue, would that just be solved by deleting cookies and history?[/QUOTE]
no, this would be more of a php caching issue and would be an issue for your server. the more i think about this one the less likely it seems to be. Did you ensure that the changed index.php is properly uploaded?

Convert your index page to Headlines

Posted on: 08/05/05 05:43pm
By: ofey

I can do that. But surely that's not what's causing my prob, or is it?

Convert your index page to Headlines

Posted on: 08/05/05 05:50pm
By: ofey

I presume the index.php file I'm to change is at:
/trojanswimclub.ie/index.php
Does that sound correct?

Convert your index page to Headlines

Posted on: 08/05/05 05:58pm
By: machinari

yes, that sounds correct.

Convert your index page to Headlines

Posted on: 08/05/05 05:59pm
By: ofey

Oh I'm not the brightest
I edited index.thtml instead of index.php
All sorted now.
Thanks for your patience.

Convert your index page to Headlines

Posted on: 16/05/05 07:50am
By: Robin

Below you can find an updated version, for GL 1.3.11, of the hack that will enable you to list titles only on the front page. Original instructions in the first post in this topic.

1. firstly, you create a new template frontstorytext.thtml

with the following content
<table width="100%" border="0" cellspacing="0" cellpadding="2">
	<tr>
		<td colspan="2" align="left" bgcolor="#e1e2e5"><span class="articleTitle"><a href="{site_url}/article.php?story={story_id}">{story_title}</a></span></td>
	</td>
	</tr>
</table>


2. next, open index.php

3. find: $display .= STORY_renderArticle($A,'y');

4. replace with: $display .= STORY_renderArticle( $A, 'y', 'frontstorytext.thtml' );

5. save, and you're good to go


Convert your index page to Headlines

Posted on: 04/06/05 06:06am
By: Anonymous

how can i add a short date to it, in dd/mm/yyyy format?

{story_date} returns long date, together with time...

Convert your index page to Headlines

Posted on: 04/06/05 06:55am
By: Anonymous

<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="20%">{story_date}</td>
<td width="80%" align="left" bgcolor="#e1e2e5"><span class="articleTitle"><a href="{site_url}/article.php?story={story_id}">{story_title}</a></span></td>
</td>
</tr>
</table>


so if I used it like this, the date is "Friday, February 25 2005 @ 02:35 PM EST"

your hints are much appreciated

Convert your index page to Headlines

Posted on: 04/06/05 03:46pm
By: Dirk

The date is formatted according to the user's preferred date format (from their preferences) or according to $_CONF['date'] if they chose "system default" (or are not logged in).

bye, Dirk

Convert your index page to Headlines

Posted on: 14/07/05 07:05pm
By: Anonymous

:banana:

Thanks a lot, specially to robin. This was of great help to me. The geeklog forum rules Dirk.

Regards,
Ruchir

Convert your index page to Headlines

Posted on: 22/11/05 05:16pm
By: eyecravedvd

I have an interesting dilemma when implementing this hack. It only converts the first story into a headline and all the rest show the normal story. Any advice?

Can be seen here

Cheers,

Shane

Convert your index page to Headlines

Posted on: 22/11/05 05:22pm
By: eyecravedvd

Nevermind. There are 2 spots you must place it in index.php... fixed.

Re: Convert your index page to Headlines

Posted on: 11/01/07 05:56pm
By: Don

I'm bumping this because I'm searching for code that will do exactly this.

Any chance this will work in 1.4.1?

- Don

Re: Convert your index page to Headlines

Posted on: 03/04/07 12:21am
By: Don

Is there a way to modify this to display links to files that have been uploaded via File Mangement?

- Don

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=21316