Page 1 of 2
New static page options - please explain
Posted: Wed Nov 12, 2008 6:49 pm
by Don Chambers
Garvin - can you explain the latest modifications to static pages? Specifically, how do we a) create custom fields, that vary from one static page to another, and b) use those custom fields in our smarty templates.... Perhaps such an explanation could also find its way into the user docs..

Re: New static page options - please explain
Posted: Wed Nov 12, 2008 9:22 pm
by garvinhicking
Hi!
a.) You simply create different backend_template templates where you put those options into
Did you read the blog.s9y.org post explaining those changes as well as the changelog file of staticpages? What is left unclear, then I can specifically mention how to be able to understand it.
http://blog.s9y.org/archives/199-Improv ... lugin.html
http://php-blog.cvs.sourceforge.net/vie ... ortby=date
Regards,
Garvin
Posted: Wed Nov 12, 2008 9:46 pm
by Don Chambers
Thanks Garvin - I knew I read about it a few months ago, and searched the forums here like crazy... I completely forgot to check the s9y blog! Will let you know if I have any further questions.
On a related note, the sidebar tpls have meta info shown like this:
Code: Select all
{if $staticpage_author}
<div class="staticpage_author">{$staticpage_author|@escape}</div>
{/if}
<div class="staticpage_metainfo">
{if $staticpage_lastchange}
<span class="staticpage_metainfo_lastchange">{$staticpage_lastchange|date_format:"%Y-%m-%d"}</span>
{/if}
How would a static page ever NOT have an author or lastchange? I would like to turn off that info on some static pages, but not others.
Posted: Wed Nov 12, 2008 10:35 pm
by garvinhicking
Hi!
You could create a custom staticpage variable like "showauthor" and "showlastchange" in this case? I don't know why an IF check is inside that file, I also do not know how a staticpage could not have that info...
Regards,
Garvin
Posted: Wed Nov 12, 2008 11:11 pm
by Don Chambers
Well, I didn't put it there!
Actually, I like the {if}... now how about we make it functional.... each static page could have an additional option about whether to show this information or not (perhaps a separate option for author vs. date).... the option could default to yes for BC, and if a particular static page was set to no, the smarty variable never gets assigned?
Posted: Thu Nov 13, 2008 1:57 pm
by garvinhicking
Hi!
Hm, now that the default static page template has been trimmed down, I'm not sure if I now want additional checks like this blowing up the staticpage layout once again. Maybe better create a new "detailed" backend template where such options would be presented, but not in the default view?
Regards,
Garvin
Posted: Thu Nov 13, 2008 3:08 pm
by Don Chambers
How many websites do you see where a "static" page has the author name and last revision date right on the page? I cannot think of many, which is why I thought this would be a valuable thing to have under all scenarios, not just the new backend template. I also thought it could be a simple matter of emptying out, or not setting, the smarty variable so that it worked easily with the existing tpls..... and I think using css to hide the info is not appropriate, especially since some users may want it, or may want to use it for some, but not for others.
How about if I tip you off to a typo??!!!
Based on the other code, I'm going to guess that should be class="sect_struct".
Posted: Thu Nov 13, 2008 3:34 pm
by garvinhicking
Hi!
Thanks for the typo, I just fixed it.
Regarding the options: Don't you also really like how small and tidied up the new interface is? I'd hate to clumber it up with options like "show timestamp? show author? show full authorname? show author on top? Show author on bottom? Show nude author?".
IMHO we should draw a line for the default template. It should really only contain those things that you decide on a per-template basis. IMHO regarding the more general look of a staticpage, this should be decided either in the pagetype configuration, in the plugin configuration or (the best, but hardest way for a user) through the template file itself...
I think having a "detailed template" view would be better, so that users could prioritize their views, and the default view is really cleaned up.
Regards,
Garvin
Posted: Thu Nov 13, 2008 4:11 pm
by Don Chambers
I guess who the author really is would influence if having an option to "show nude author" is really a good idea or not.

I don't think anyone would want that particular visual experience on my site!!!
This author name and last revision date has bugged me for a very long time... it reminds me of static websites a long time ago where you would see something in the the footer of every html page, such as "last updated on".... and it always made me wonder about that site when I would see a date years in the past.
I personally know how to eliminate it in a template.... and I personally know how to hide it using css. I was thinking on behalf of others who do not know how to do it, or switch their templates from time to time and lose/gain the functionality if it is template specific. I have, in fact, taken those out of a template I have been working on - but now *I* have made the unilateral decision to not show that information... while someone could add it back, it would not be easy for a casual user to do so... and I really didn't want to make it a template option (I have too many options already).
Positioning the information on the page, such as top, bottom, side, etc isn't really necessary - that IS more appropriate for a template.
And, perhaps I am being overly ignorant here, but looking at the template code, it seems a relatively simple matter to have 1 or 2 radio buttons for author name and revision date, and if set to yes, simply do not assign the smarty meta variables... the conditional logic is already in the tpl.
But, this is just one person's perspective....

Posted: Thu Nov 13, 2008 5:00 pm
by garvinhicking
Hi!
I agree. How about acutally removing the author and date information by default, so that people would need to explcitly enable that using the new detailed backend template view?
I really, really would like to have a very small and lean default view when creating/editing a staticpage...
Regards,
Garvin
Posted: Thu Nov 13, 2008 5:39 pm
by Don Chambers
Would that work ok with templates (like bp) that supply tpls that already have the author name and last modified date in there?
How about a backend option instead if you are worried about cluttering up the static page config screen?
Posted: Thu Nov 13, 2008 6:04 pm
by garvinhicking
Hi!
Don Chambers wrote:Would that work ok with templates (like bp) that supply tpls that already have the author name and last modified date in there?
Those would need to be updated of course, to utilize the extended custom properties of the templates.
How about a backend option instead if you are worried about cluttering up the static page config screen?
How do you mean that exactly? I am talking about this:
- Create a backend_templates/detail.tpl file in the staticpage directory
- Edit that file to add serendipity[plugin][custom][show_author] etc. fields
- Edit the plugin_staticpage.tpl file to check on this show_author field to only show it when that variable is set.
Now once an author creates a staticpage, uses the detail template file to set an option and then stores that staticpage, the settings should take on the frontend file.
Regards,
Garvin
Posted: Thu Nov 13, 2008 9:02 pm
by Don Chambers
Let me digest this for a bit.....
While I do, you might want to look at the "all fields" view, with the emoticon plugin active and your editor set to wysiwyg. Think there is just a bit of html that needs restructuring - I get all the emoticons stacked on top of each other in a single column to the far right of the page.
Posted: Thu Dec 11, 2008 6:04 pm
by Don Chambers
Garvin - I finally found the time to return to this issue.
Are you suggesting that this concept of "show author", etc, be added to the default_staticpage_backend.tpl in the plugin, or just to templates that want to use it?
If, for instance, my own template, how does this look (total guess on my part since a radio option is not demonstrated in your commented code):
Code: Select all
<fieldset class="sect_custom">
<legend>Creation/Modification Info</legend>
<div class="sp_sect">
<label class="sp_label" title="Show Author">Show Author?</label><br />
<input id="author_yes" type="radio" name="serendipity[plugin][custom][show_author]" value="{$CONST.YES}" />
<label for="author_yes">{$CONST.YES}</label>
<input id="author_no" type="radio" name="serendipity[plugin][custom][show_author]" checked value="{$CONST.NO}" />
<label for="author_no">{$CONST.NO}</label>
</div>
</fieldset>
Posted: Thu Dec 11, 2008 6:18 pm
by garvinhicking
Hi!
Yeah, exactly (but to a *detail.tpl file, not the default one).
And one would need to modify the code that always "true" or "false" is contained in the radio value="" field (otherwise it's hard to check because $CONST.YES is language specific. So smething like:
Code: Select all
<fieldset class="sect_custom">
<legend>Creation/Modification Info</legend>
<div class="sp_sect">
<label class="sp_label" title="Show Author">Show Author?</label><br />
<input id="author_yes" type="radio" name="serendipity[plugin][custom][show_author]" {if $form_values.custom.show_author == 'true'}checked="checked"{/if}value="true" />
<label for="author_yes">{$CONST.YES}</label>
<input id="author_no" type="radio" name="serendipity[plugin][custom][show_author]" {if $form_values.custom.show_author != 'true'}checked="checked"{/if} value="false" />
<label for="author_no">{$CONST.NO}</label>
</div>
</fieldset>
HTH,
Garvin