Welcome to Geeklog, Anonymous Sunday, November 24 2024 @ 07:55 am EST

Geeklog Forums

Convert your index page to Headlines

Page navigation


Status: offline

knuckles

Forum User
Chatty
Registered: 12/17/01
Posts: 35
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
Text Formatted Code
<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:

Text Formatted Code
<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
 Quote

Status: offline

robinbowes

Forum User
Junior
Registered: 08/06/02
Posts: 23
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.
 Quote

Anonymous

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

Anonymous

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

Status: offline

knuckles

Forum User
Chatty
Registered: 12/17/01
Posts: 35
ssss
 Quote

Status: offline

jimphelps

Forum User
Junior
Registered: 10/10/02
Posts: 20
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.
 Quote

Status: offline

elf

Forum User
Newbie
Registered: 03/22/03
Posts: 4
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.
 Quote

Status: offline

Norgs

Forum User
Junior
Registered: 12/16/03
Posts: 17
Hey guys,

Did a working example of this ever turn up?

Thanks
 Quote

Status: offline

varian vega

Forum User
Newbie
Registered: 05/21/04
Posts: 10
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
 Quote

Status: offline

thedailycynic

Forum User
Junior
Registered: 09/12/04
Posts: 17
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?
Music News Washington DC
Graphic Design Virginia

Record Label Washington DC

Active Sports Wear
 Quote

Status: offline

jason559

Forum User
Regular Poster
Registered: 03/31/03
Posts: 83
How can I get this to work with the current version of geeklog? Can someone help me
 Quote

Status: offline

ofey

Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
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? Can someone help me


Regards,

Ofey
Those who say it can't be done, are usually interrupted by others doing it.
 Quote

mach

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

Status: offline

ofey

Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
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?


Those who say it can't be done, are usually interrupted by others doing it.
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Quote by ofey: Anyone know why in step 13. it says '...replace...'
Wouldn't frontstorytext.thtml be empty to start with?

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

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Also, check that you've properly uploaded the edited index.php to your server.
 Quote

Status: offline

ofey

Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
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.
Those who say it can't be done, are usually interrupted by others doing it.
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Quote by ofey: Created a new template file frontstorytext.thtml ...

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 Just my two cents
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Quote by ofey: Hey Machinari,

When you say a cache issue, would that just be solved by deleting cookies and history?

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

Status: offline

ofey

Forum User
Full Member
Registered: 03/18/05
Posts: 213
Location:Dublin, Ireland
I can do that. But surely that's not what's causing my prob, or is it?
Those who say it can't be done, are usually interrupted by others doing it.
 Quote

Page navigation

All times are EST. The time is now 07:55 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content