Welcome to Geeklog, Anonymous Thursday, April 25 2024 @ 12:42 am EDT

Geeklog Forums

Story at top...


Status: offline

trampoline

Forum User
Full Member
Registered: 02/24/06
Posts: 392
How do you allow the front page to continue after a story URL has been selected ?

I run a news site so people come and visit via a news link from google...

That is great but I want the front page to start after the story they came to see.

This is really essential how can we do this ?

Thanks...
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Hello, Trampoline

You could make a portal block with a rss feed from your last news and plublish this only block to the right and build a theme with right blocks below (or use chameleon plugin).

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

trampoline

Forum User
Full Member
Registered: 02/24/06
Posts: 392
Quote by: cordiste

Hello, Trampoline

You could make a portal block with a rss feed from your last news and plublish this only block to the right and build a theme with right blocks below (or use chameleon plugin).

::Ben



Maybe I could hack the story template and put it at the bottom of the story ... ?

For news sites this is kind of essential..
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Or you could use CUSTOM_templateSetVars() in lib-custom.php

Text Formatted Code

/**
* Include any code in this function to add custom template variables.
* Initially, this function is only called in the COM_siteHeader function to set
* header.thtml variables
*/
function CUSTOM_templateSetVars ($templatename, &$template)
{
    if ($templatename == 'header') {
        // define a {hello_world} variable which displays "Hello, world!"
        $template->set_var ('hello_world', 'Hello, world!');
    }
}


::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Oups sorry it's doesn't help. This function only work in header.thtml

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by: cordiste

Oups sorry it's doesn't help. This function only work in header.thtml


No, it also works in the article templates (and a couple of other places).

Someone please file a bug report to update the documentation and the sample code in lib-custom.php

bye, Dirk
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
So function is working and bug was reported Smile

::Ben


I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

trampoline

Forum User
Full Member
Registered: 02/24/06
Posts: 392
Quote by: cordiste

So function is working and bug was reported Smile

::Ben



So this would work ?

Great

I have geeklog 1.4.1b

can anyone give me sample code ?

Thanks...
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Here's the new sample code I just checked in:
Text Formatted Code
/**
* Include any code in this function to add custom template variables.
*
* Called from within Geeklog for:
* - 'header' (site header)
* - 'footer' (site footer)
* - 'storytext', 'featuredstorytext', 'archivestorytext' (story templates)
* - 'story' (story submission)
* - 'comment' (comments)
* - 'registration' (user registration form)
* - 'contact' (email user form)
* - 'emailstory' (email story to a friend)
*
* This function is called whenever PLG_templateSetVars is called, i.e. in
* addition to the templates listed here, it may also be called from plugins.
*
* @param    string  $templatename   name of the template, e.g. 'header'
* @param    ref    &$template       reference to the template
* @return   void
* @see      PLG_templateSetVars
*
*/
function CUSTOM_templateSetVars($templatename, &$template)
{
    // define a {hello_world} variable available in header.thtml and
    // a {hello_again} variable available in the story templates

    switch ($templatename) {
    case 'header':
        $template->set_var('hello_world', 'Hello, world!');
        break;

    case 'storytext':
    case 'featuredstorytext':
    case 'archivestorytext':
        $template->set_var('hello_again', 'Hello (again)!');
        break;
    }
}

This should work as of Geeklog 1.4.1 (final version - some changes happened here during the beta / release candidate phase).

bye, Dirk
 Quote

Status: offline

trampoline

Forum User
Full Member
Registered: 02/24/06
Posts: 392
So I could put in an RSS feed here ?
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
@ Dirk

CUSTOM_templateSetVars case:comment (comments ) is only working in the comment form. Maybe we should specify this.

@Trampoline

I see no way with CUSTOM_templateSetVars because it is working for featurestorytext.thtml or storytext.thtml but here we would need it for article.thtml like this

Text Formatted Code
        $template->set_var('my_rss', DB_getItem('gl_blocks', 'content',"bid = '12'"));


Where 12 is the block id of the portal block.

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

trampoline

Forum User
Full Member
Registered: 02/24/06
Posts: 392
Quote by: cordiste

@ Dirk

CUSTOM_templateSetVars case:comment (comments ) is only working in the comment form. Maybe we should specify this.

@Trampoline

I see no way with CUSTOM_templateSetVars because it is working for featurestorytext.thtml or storytext.thtml but here we would need it for article.thtml like this

Text Formatted Code
        $template->set_var('my_rss', DB_getItem('gl_blocks', 'content',"bid = '12'"));


Where 12 is the block id of the portal block.

::Ben



Ho Humm....

I'm confused... would this mow appear at the bottom of the story as an rss feed ?
That would be fine...

Now I'm thinking maybe an RSS feed would also be a good block to put at the top of the home page....

So going back to your code here,

I just produce a portal block RSS feed and insert this code in the story.thtml and hey presto it should work ???
Great...
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Thanks for the correction - fixed now. I guess "comment" is not the best name, but at least it's consistent with "story" for the story submission form ...

As for the article template: Right, there's no such thing. You could define whatever you need for storytext, but only if the current URL contains "article.php". Slightly hackish, but still better than modifying the core code and causing headaches with the next upgrade.

bye, Dirk
 Quote

Status: offline

trampoline

Forum User
Full Member
Registered: 02/24/06
Posts: 392
Quote by: cordiste

@ Dirk

CUSTOM_templateSetVars case:comment (comments ) is only working in the comment form. Maybe we should specify this.

@Trampoline

I see no way with CUSTOM_templateSetVars because it is working for featurestorytext.thtml or storytext.thtml but here we would need it for article.thtml like this

Text Formatted Code
        $template->set_var('my_rss', DB_getItem('gl_blocks', 'content',"bid = '12'"));


Where 12 is the block id of the portal block.

::Ben



Ok I have created a Portal Block that pulls in an RSS feed from the site....
is there any way to make the initial text longer ?

also where do I find the block ID ?

is this it I just place the Block ID in your code paste into the story text.thtml and that is it ???
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
You will find the block id when you try to edit it for exemple.

The issue is if you add the variable in storytext.html the rss feed will be also appear in the front page or topic page. So you could replace both by a static page with a rss feed or as Dirk says
You could define whatever you need for storytext, but only if the current URL contains "article.php"


::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

All times are EDT. The time is now 12:42 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