Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 05:58 am EST
Geeklog Forums
Story at top...
trampoline
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...
::Ben
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
trampoline
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..
::Ben
/**
* 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
Dirk
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
trampoline
So function is working and bug was reported
::Ben
So this would work ?
Great
I have geeklog 1.4.1b
can anyone give me sample code ?
Thanks...
Dirk
* 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
trampoline
::Ben
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
Where 12 is the block id of the portal block.
::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
trampoline
@ 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
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...
Dirk
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
trampoline
@ 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
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 ???
::Ben
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
::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
- 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