Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 11:28 am EST
Geeklog Forums
Create block that shows in stories only (articles)?
Status: offline
RickW
Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
I want to create a block that only shows up when viewing a full article. Right now my only options are to restrict the blocks per topic. How can I accomplish this?
(feature request: add "Just Stories" as an option)
Also, is storybodytext.thtml still used at all? In the original professional theme this file is left blank. I tried putting some content in it as a test, and it doesn't show up when viewing full stories. How do you call this file?
www.antisource.com
(feature request: add "Just Stories" as an option)
Also, is storybodytext.thtml still used at all? In the original professional theme this file is left blank. I tried putting some content in it as a test, and it doesn't show up when viewing full stories. How do you call this file?
www.antisource.com
6
4
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
you can throw your block content into article.thtml just as the "what's related" and "story_options" are.
of course if the block content is dynamic, then you will have to hack the core in order to get your variables in there. For minimal damage to the core, write your block function in lib-custom as usual and then just call that function in the proper place in article.php--see lines 172-230. insert your variable in the template file however you like and you're all done.
of course if the block content is dynamic, then you will have to hack the core in order to get your variables in there. For minimal damage to the core, write your block function in lib-custom as usual and then just call that function in the proper place in article.php--see lines 172-230. insert your variable in the template file however you like and you're all done.
6
7
Quote
Status: offline
RickW
Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
Quote by machinari: you can throw your block content into article.thtml just as the "what's related" and "story_options" are.
Nah I can't, because I rewrote my theme from scratch and in doing so, what's related and story_options end up appended to my article rather than showing up as a right-block. I forgot to clarify that - I want to create a right-block that only shows up in articles.
Thanks for the mention about article.thtml though, that gives me an idea for something else I'm trying to figure out...
www.antisource.com
5
6
Quote
Status: offline
RickW
Forum User
Full Member
Registered: 01/28/04
Posts: 240
Location:United States
I looked at the php_block how-to, but am still really confused how to do this.
edit:
I don't understand how a php_block will help me, because when viewing articles, even if the block is set to All, I can't see it on the articles page.
www.antisource.com
edit:
I don't understand how a php_block will help me, because when viewing articles, even if the block is set to All, I can't see it on the articles page.
www.antisource.com
4
6
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
go to article.php around line 241ish and change
to this:
This will put right column blocks on your story page. However, that will screw up most themes that put "what's related" and "story options" to the right of the story.
Text Formatted Code
$display .= COM_siteFooter ();Text Formatted Code
$display .= COM_siteFooter (true);This will put right column blocks on your story page. However, that will screw up most themes that put "what's related" and "story options" to the right of the story.
6
21
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
A PHP block should simply return what it wants to be displayed between the block's header and footer (i.e. those are added automatically by Geeklog). There are a few simple examples in your lib-custom.php
bye, Dirk
bye, Dirk
5
5
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
try starting with something like this:
/* comments
This block checks the calling page and returns data
only if that page is article.php
*/
phpblock_yourfunction()
{
$a = COM_getCurrentURL();
if(!eregi('article.php',$a))
{
return '';
}
else
{
$retval = ''
//your logic here
//and some more here :P
return $retval;
}
}
?>
that in conjunction with your topic setting for the block should cause the block to only display in the intended topic and only when the full story is called. throw the function in your lib-custom.php, create the phpblock, and if you don't want the right column then just set the block to display in the left column.
That should be more than enough to get you going.
Text Formatted Code
<?PHP/* comments
This block checks the calling page and returns data
only if that page is article.php
*/
phpblock_yourfunction()
{
$a = COM_getCurrentURL();
if(!eregi('article.php',$a))
{
return '';
}
else
{
$retval = ''
//your logic here
//and some more here :P
return $retval;
}
}
?>
That should be more than enough to get you going.
8
5
Quote
All times are EST. The time is now 11:28 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