Welcome to Geeklog Thursday, May 23 2013 @ 06:47 AM EDT
|
||||||||
![]() |
Forum Index > Support > Plugin Support |
New Topic
|
Post Reply
|
Static pages in articles |
|||
| Pushkar |
|
||||||
![]() ![]() ![]() ![]() ![]() Regular Poster Status: offline ![]() Registered: 04/14/09 Posts: 99 |
Hello! Could it possible to show static pages under content of articles of some topics?
For example I need to add block of last topic articles after story content |
||||||
|
|||||||
| suprsidr |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member Status: offline ![]() Registered: 12/29/04 Posts: 552 |
I've been known to use the same method Chris describes in this article to pull content from other pages into my articles.
-s FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com |
||||||
|
|||||||
| jmucchiello |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member Status: offline ![]() Registered: 08/29/05 Posts: 985 |
(I'm writing this without access to the source code so the details might be a bit off.)
Add a variable to your article templates: {extracontent} In lib-custom, override CUSTOM_setTemplateVars($type, $template) PHP Formatted Code function CUSTOM_setTemplateVars($type, $template) { global $_TABLES; if ($type != 'article') return; $topic = DB_getItem($_TABLES['stories'], 'topic', "sid = '". $template->get_var('sid') ."'"); if ($topic != 'the right topic') return; $extra = staticpage_generatepage('pageid'); // there are a few parameters here $template->set_var('extracontent', $extra); } |
||||||
|
|||||||
| Pushkar |
|
||||||
![]() ![]() ![]() ![]() ![]() Regular Poster Status: offline ![]() Registered: 04/14/09 Posts: 99 |
I added this function to lib-custom
PHP Formatted Code function CUSTOM_setTemplateVars($type, $template) { global $_TABLES; if ($type != 'article') return; $topic = DB_getItem($_TABLES['stories'], 'topic', "sid = '". $template->get_var('sid') ."'"); if ($topic != 'the right topic') return; $extra = staticpage_generatepage('pageid'); // there are a few parameters here $template->set_var('extracontent', $extra); } and this {extracontent} I added to article.thtml but nothing changed |
||||||
|
|||||||
| jmucchiello |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member Status: offline ![]() Registered: 08/29/05 Posts: 985 |
I told you I was posting without access to the code and so some things may not be accurate. The function should be called CUSTOM_templatesetvars. Also the $type will be "featuredstorytext", "archivestorytext" or "storytext" and not "article" as I presumed.
You need to change the strings 'the right topic' and 'pageid' to the actual values needed for your install. I have access to the Geeklog sources now so here is an updated function. But you still have to fill in a few details: the topic_id and the staticpage_id PHP Formatted Code function CUSTOM_templatesetvars($type, $template) { global $_TABLES; if ($type != 'featuredstorytext' && $type != 'archivestorytext' && $type != 'storytext') return; $topic = DB_getItem($_TABLES['stories'], 'tid', "sid = '". $template->get_var('story_id') ."'"); if ($topic != 'the right topic') return; // you have to put the tid of the topic you want here $extra = SP_returnStaticpage('pageid'); // there are a few parameters here $template->set_var('extracontent', $extra); } AND you need to put the {extracontent} into the storytext.thtml (and featuredstorytext.thtml and archivestorytext.thtml). That will ensure it is displayed with every appearance of the story. |
||||||
|
|||||||
| Pushkar |
|
||||||
![]() ![]() ![]() ![]() ![]() Regular Poster Status: offline ![]() Registered: 04/14/09 Posts: 99 |
it is works but there some problems:
1) It displays the contents of the entire page, but I need to display only the content of static page 2) how to make this code work in article.thtml? because when I put {extracontent} in storytext.thtml it is displaying in preview of each story, but I need only in full text of story thanks Quote by: jmucchiello
I told you I was posting without access to the code and so some things may not be accurate. The function should be called CUSTOM_templatesetvars. Also the $type will be "featuredstorytext", "archivestorytext" or "storytext" and not "article" as I presumed. PHP Formatted Code function CUSTOM_templatesetvars($type, $template) { global $_TABLES; if ($type != 'featuredstorytext' && $type != 'archivestorytext' && $type != 'storytext') return; $topic = DB_getItem($_TABLES['stories'], 'tid', "sid = '". $template->get_var('story_id') ."'"); if ($topic != 'the right topic') return; // you have to put the tid of the topic you want here $extra = SP_returnStaticpage('pageid'); // there are a few parameters here $template->set_var('extracontent', $extra); } AND you need to put the {extracontent} into the storytext.thtml (and featuredstorytext.thtml and archivestorytext.thtml). That will ensure it is displayed with every appearance of the story. |
||||||
|
|||||||
| jmucchiello |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member Status: offline ![]() Registered: 08/29/05 Posts: 985 |
1) add a second parameter to SP_returnStaticpage('pageid', 'autotag'
2) Put {extracontent} in the article.thtml and change the 2nd line of the function back to if ( $type != 'article' ) return; Quote by: Pushkar it is works but there some problems: Quote by: jmucchiello I told you I was posting without access to the code and so some things may not be accurate. The function should be called CUSTOM_templatesetvars. Also the $type will be "featuredstorytext", "archivestorytext" or "storytext" and not "article" as I presumed. With the changes above: PHP Formatted Code function CUSTOM_templatesetvars($type, $template) { global $_TABLES; if ($type != 'article') return; $topic = DB_getItem($_TABLES['stories'], 'tid', "sid = '". $template->get_var('story_id') ."'"); if ($topic != 'the right topic') return; // you have to put the tid of the topic you want here $extra = SP_returnStaticpage('pageid', 'autotag'); // there are a few parameters here $template->set_var('extracontent', $extra); } |
||||||
|
|||||||
| Pushkar |
|
||||||
![]() ![]() ![]() ![]() ![]() Regular Poster Status: offline ![]() Registered: 04/14/09 Posts: 99 |
anything changes are here and still not working in atricle.thtml there is my code: PHP Formatted Code function CUSTOM_templatesetvars($type, $template) { global $_TABLES; if ($type != 'article' && $type != 'storytext') return; $topic = DB_getItem($_TABLES['stories'], 'tid', "sid = '". $template->get_var('story_id') ."'"); if ($topic != 'humor') return; // you have to put the tid of the topic you want here $extra = SP_returnStaticpage('20080627113900520', 'staticpage_content'); // there are a few parameters here $template->set_var('extracontent', $extra); } Quote by: jmucchiello
1) add a second parameter to SP_returnStaticpage('pageid', 'autotag' PHP Formatted Code function CUSTOM_templatesetvars($type, $template) { global $_TABLES; if ($type != 'article') return; $topic = DB_getItem($_TABLES['stories'], 'tid', "sid = '". $template->get_var('story_id') ."'"); if ($topic != 'the right topic') return; // you have to put the tid of the topic you want here $extra = SP_returnStaticpage('pageid', 'autotag'); // there are a few parameters here $template->set_var('extracontent', $extra); } |
||||||
|
|||||||
| jmucchiello |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member Status: offline ![]() Registered: 08/29/05 Posts: 985 |
Apparently I'm hallucinating. I thought there was a call to PLG_templatesetvars() in article.php. There isn't. You could add one, but then you would have to add it everytime you upgrade. You could put in a feature request and hope they add it. Or we can go back to the older code and add another check:
Here you have to add {extracontent} back into featuredstorytext.thtml and storytext.thtml and archivestorytext.thtml. In theory, the "story_display" value is set to article when the story is rendered from article.php. But again, I'm not 100% sure. PHP Formatted Code function CUSTOM_templatesetvars($type, $template) { global $_TABLES; if ($type != 'featuredstorytext' && $type != 'archivestorytext' && $type != 'storytext') return; if ($template->get_var('story_display') != 'article') return; $topic = DB_getItem($_TABLES['stories'], 'tid', "sid = '". $template->get_var('story_id') ."'"); if ($topic != 'the right topic') return; // you have to put the tid of the topic you want here $extra = SP_returnStaticpage('pageid'); // there are a few parameters here $template->set_var('extracontent', $extra); } |
||||||
|
|||||||
| Pushkar |
|
||||||
![]() ![]() ![]() ![]() ![]() Regular Poster Status: offline ![]() Registered: 04/14/09 Posts: 99 |
yes! it is displaying only in full story text
but still show all page of statispage but not static page content Quote by: jmucchiello
Apparently I'm hallucinating. I thought there was a call to PLG_templatesetvars() in article.php. There isn't. You could add one, but then you would have to add it everytime you upgrade. You could put in a feature request and hope they add it. Or we can go back to the older code and add another check: PHP Formatted Code function CUSTOM_templatesetvars($type, $template) { global $_TABLES; if ($type != 'featuredstorytext' && $type != 'archivestorytext' && $type != 'storytext') return; if ($template->get_var('story_display') != 'article') return; $topic = DB_getItem($_TABLES['stories'], 'tid', "sid = '". $template->get_var('story_id') ."'"); if ($topic != 'the right topic') return; // you have to put the tid of the topic you want here $extra = SP_returnStaticpage('pageid'); // there are a few parameters here $template->set_var('extracontent', $extra); } |
||||||
|
|||||||
| Pushkar |
|
||||||
![]() ![]() ![]() ![]() ![]() Regular Poster Status: offline ![]() Registered: 04/14/09 Posts: 99 |
jmucchiello, can you help me?
|
||||||
|
|||||||
| jmucchiello |
|
||||||
![]() ![]() ![]() ![]() ![]() Full Member Status: offline ![]() Registered: 08/29/05 Posts: 985 |
I think you need to add 'autotag' as shown here, but again, I'm away from the code:
PHP Formatted Code $extra = SP_returnStaticpage('pageid','autotag'); // there are a few parameters here $template->set_var('extracontent', $extra); } |
||||||
|
|||||||
| Pushkar |
|
||||||
![]() ![]() ![]() ![]() ![]() Regular Poster Status: offline ![]() Registered: 04/14/09 Posts: 99 |
I put the name of my autotag [staticpage_content:] instead "autotag" Quote by: jmucchiello
I think you need to add 'autotag' as shown here, but again, I'm away from the code: PHP Formatted Code $extra = SP_returnStaticpage('pageid','autotag'); // there are a few parameters here $template->set_var('extracontent', $extra); } |
||||||
|
|||||||
| Content generated in: 2.44 seconds |
|
|
|