I want to add one entry from one category on the static page that is set to be frontpage.
A solved this partly with this code in plugin_staticpage-tpl:
Code:
{serendipity_fetchPrintEntries category=1 limit=1 use_hooks=0 template=entries_news.tpl}
Works great except that is is printed on all static pages.
Is there any easy way to solve this, to check if the static page is a frontpage before printing?
Post entries only on frontpage
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Post entries only on frontpage
Hi!
You can set up differet Static Page "Types". For each Type you can use a different .tpl file. So just create a new type "Frontpage", then use "plugin_staticpage_frontpage.tpl" for its template.
Then edit your frontpage staticpage. Switch the type to "Frontpage" you just created.
Then create the plugin_staticpage_frontpage.tpl file and only in that file you insert the smarty call. Your other pages will then use an unmodified plugin_staticpage.tpl file.
There are also other ways to do this:
1. You could use a check "{if $staticpage_pagetitle ="Title of your frontpage"} ... {/if}
2. Or you could even install and use the smartymarkup plugin, and then not put the smarty code inside your .tpl file, but instead inside the content of your staticpage plugin.
Best regards,
Garvin
You can set up differet Static Page "Types". For each Type you can use a different .tpl file. So just create a new type "Frontpage", then use "plugin_staticpage_frontpage.tpl" for its template.
Then edit your frontpage staticpage. Switch the type to "Frontpage" you just created.
Then create the plugin_staticpage_frontpage.tpl file and only in that file you insert the smarty call. Your other pages will then use an unmodified plugin_staticpage.tpl file.
There are also other ways to do this:
1. You could use a check "{if $staticpage_pagetitle ="Title of your frontpage"} ... {/if}
2. Or you could even install and use the smartymarkup plugin, and then not put the smarty code inside your .tpl file, but instead inside the content of your staticpage plugin.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Thanx alot for that answer.
But if I want to do this in normal entries, how do I do? I have partly solved this if the entrie is the startpage:
But how can I do this if the entrie isn´t the startpage? What shall one look for instead of $staticpage_pagetitle?
Probably very easy (newbie) but I can´t find the solution right now.
But if I want to do this in normal entries, how do I do? I have partly solved this if the entrie is the startpage:
Code: Select all
{if $startpage}
{serendipity_fetchPrintEntries category="3" limit="1" use_hooks="0" template=entries_start.tpl}
{serendipity_fetchPrintEntries category="1" limit="1" use_hooks="0" template=entries_news.tpl}Probably very easy (newbie) but I can´t find the solution right now.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Uhm, I don't really understand what you want to do? Could you explain more in depth what you're trying to achieve?
$staticpage_pagetitle is actually the best thing to look for...?!
Best regards,
Garvin
Uhm, I don't really understand what you want to do? Could you explain more in depth what you're trying to achieve?
$staticpage_pagetitle is actually the best thing to look for...?!
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Ok, I try to explaine a little better.
What I do right now is that in entries.tpl I check if the selected page is the startpage and if it is so, 2 articles are displayed with 2 different looks/templates. I use this code for that:
What I want to do is the same but for any other selected page. I have an article named “10-Recepcion.html” witch I want to do the same in. I want to check if the selected page is this page (10-Recepcion.html) and if so, I want to display 2 other articles.
Is it possible in some way to check for id or page title and do the same thing as the code above?
I could use a static page for this but I think would be nice to do it without them. I am making a webpage with 2 languages and has done this with 2 folders for all categories (1 for each language) and has assigned different templates to these categories instead of using the multilingual plugin.
What I do right now is that in entries.tpl I check if the selected page is the startpage and if it is so, 2 articles are displayed with 2 different looks/templates. I use this code for that:
Code: Select all
{if $startpage}
{serendipity_fetchPrintEntries category="3" limit="1" use_hooks="0" template=entries_start.tpl}
{serendipity_fetchPrintEntries category="1" limit="1" use_hooks="0" template=entries_news.tpl}Is it possible in some way to check for id or page title and do the same thing as the code above?
I could use a static page for this but I think would be nice to do it without them. I am making a webpage with 2 languages and has done this with 2 folders for all categories (1 for each language) and has assigned different templates to these categories instead of using the multilingual plugin.
Last edited by jojje on Tue Aug 15, 2006 7:00 am, edited 1 time in total.
I tried with
And it work well when one visits the page "10-Recepcion.html"... but if one visits a category, the same 2 articles are displayed.
I need some other way to do this.
Code: Select all
{if $entry.title != 'Recepcion' }
{serendipity_fetchPrintEntries category="5" limit="1" use_hooks="0" template=entries_start.tpl}
{serendipity_fetchPrintEntries category="4" limit="1" use_hooks="0" template=entries_news.tpl}
{/if}I need some other way to do this.
I think I solved it.... I checked if the page is a single entry and it made it.
Thx Garvin for taking the time reading all questions I have.
Code: Select all
{if $is_single_entry AND $entry.title != 'Recepcion' }
{serendipity_fetchPrintEntries category="5" limit="1" use_hooks="0" template=entries_start.tpl}
{serendipity_fetchPrintEntries category="4" limit="1" use_hooks="0" template=entries_news.tpl}
{/if}-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Ah, very great. Sorry for not getting back earlier. But the fix you made is similiar to what I would have suggested.
Best regards,
Garvin
Ah, very great. Sorry for not getting back earlier. But the fix you made is similiar to what I would have suggested.
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Do you have any other suggestions how one can do it?
My code works great when I visit 10-Recepcion.html -- > 1 article from category 5 and 1 article from category 4 are printed on the screen
or a category --> all articles in the category is listed.
But when I visit some other article then 10-Rexepcion.html... they also are formated as described above, 1 article from category 5 and 1 article from category 4 are printed.
I am almost thinking of using a static page instead, much easier
My code works great when I visit 10-Recepcion.html -- > 1 article from category 5 and 1 article from category 4 are printed on the screen
or a category --> all articles in the category is listed.
But when I visit some other article then 10-Rexepcion.html... they also are formated as described above, 1 article from category 5 and 1 article from category 4 are printed.
I am almost thinking of using a static page instead, much easier