Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorpaul
    • CommentTimeSep 22nd 2009
     permalink
    Hello,

    is it possible to configure a theme so that it provides a template which overrides the shared templates? Such as login.tpl for example?

    Thanks and regards
    Paul.
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 22nd 2009
     permalink
    no, I'm sorry, you can't at the moment
    •  
      CommentAuthorpaul
    • CommentTimeSep 23rd 2009
     permalink
    What do you think about creating a template "management" method/function which accepts the template name as parameter, searches for the template in the current theme and, if this not exists, falls back the the shared templates?
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 23rd 2009
     permalink
    I don't like it a lot, since shared templates sometimes need to have some particular elements in order to work as intended. I would rather add a class on the body of the default.tpl template, so you can style it via CSS. (I agree that some of those shared templates are badly designed, though, and should be redesigned altogether)
    •  
      CommentAuthorpaul
    • CommentTimeSep 23rd 2009 edited
     permalink
    Posted By: NoWhereManI don't like it a lot, since shared templates sometimes need to have some particular elements in order to work as intended.


    In the custom templates, too.

    Beside the bad html design: If there is functionality in the templates which is not layout related, it should be put into the core and moved out of the templates.
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 23rd 2009 edited
     permalink
    Posted By: paulBeside the bad html design: If there is functionality in the templates which is not layout related, it should be put into the core and moved out of the templates.


    of course and it is when applicable, but it's not that simple: for instance the name= attribute of a form input must go in the template, that's how it works.
    A wrong name= and the theme would break the system.

    now imagine a theme designer releases a theme with a broken login form: the user switches her theme and then logs out.
    She won't be able to log in anymore!

    or think about a bad comment form, the blog won't accept comments anymore, and the user won't have any idea of this (unless personally notified by friends).
    •  
      CommentAuthorpaul
    • CommentTimeSep 23rd 2009
     permalink
    All this is possible at the moment, too. Just break default.tpl, index.tpl, ... A theme creator has to care about this.

    With my suggestion it would at least be possible to delete the theme and then automatically fall back on the default templates/theme. At the moment, if the theme templates are broken, this does not work!
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 23rd 2009
     permalink
    well, for instance, you can already do that with the shared comments.tpl (just include another file instead of shared:comment-form.tpl)

    but you can't do that for the login.tpl which is actually automatically included from within the default.tpl panel (which is used for the contact form and the search form too) using a variable set at runtime.

    what would you like FP to do in this case? just look for an alternate local login.tpl to be *included* into your default.tpl (similar to the current behavior) or would you rather prefer a whole new page template ?

    and if you prefer the latter, how would you accomplish backward compatibility with the old theme format ?
    •  
      CommentAuthorpaul
    • CommentTimeSep 23rd 2009
     permalink
    Posted By: NoWhereManwhat would you like FP to do in this case? just look for an alternate local login.tpl to be *included* into your default.tpl (similar to the current behavior) or would you rather prefer a whole new page template ?


    For every template loading, indepenent where it happens: 1. Look for a template with the required name in the theme template folder and 2. Look in the default template folder, if step 1 was not successfull.

    and if you prefer the latter, how would you accomplish backward compatibility with the old theme format ?


    It may be a security feature (although this is quite flimsy, as all themes can hurt if they want, including smarty-php, redirecting, whatever...), but I'd deprecate the actual theme design. Creating several root index files (index.tpl, default.tpl, admin.tpl, static.tpl, ...) is a mess IMHO. I'd create _one_ and only index.tpl and modify the content of this "frame".

    But that's another story. We can perfectly maintain compability. What would be the compibility issue for the existing templates if we use the two steps explained above?
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 23rd 2009
     permalink
    Posted By: paulBut that's another story. We can perfectly maintain compability. What would be the compibility issue for the existing templates if we use the two steps explained above?


    I think I haven't been clear in my explanation above.

    Currently there are two kinds of "shared templates", those which defines a whole page (but we won't consider theme, since we're not talking about rss/atom feeds which anyway aren't related to themes), and those which define a block inside the page;

    These "blocks" are actually of two kinds too, those to be displayed in the default.tpl of your theme, which will act as a frame (such as login.tpl, contact.tpl and search.tpl) and those who will be used somewhere else (such as comment-form which is intended to be embedded in your own comments.tpl template).

    Now, those of the second kind are not really a problem since you manually {include} them, so you might point to whatever custom template you like.

    Those of the first kind, instead, are chosen depending on some internal parameters; if you remember the (ugly, yes) structure of the default.tpl template:

    {if $rawcontent} {$content}
    {else} {include file=$content}{/if}


    they can display rawcontent (text) or force the inclusion of another template, which happen to be one of those shared I listed before

    Now, my question was what would you expect to do if you define your own login.tpl: design a whole page as you do with index.tpl and comments.tpl, so it would look something like
    {include file=header.tpl}
    // form stuff here
    {include file=footer.tpl}


    or would you rather expect it to be included into default.tpl as usual?

    this is quite different from an implementation point of view, since the second would be quite easy to implement, while the first would need some more efforts.
    •  
      CommentAuthorpaul
    • CommentTimeSep 23rd 2009
     permalink
    I'd expect the latter. I wouldn't create any more "root" files including header and footer. I would just allow to override the shared templates by custom ones. For flexibility-customization-and-avoidance-of-CSS-and-JS-hacks' sake.

    Hm.. now that I am thinking about it: This would be possible modifying the smarty (or adding a bit of php) code in the default.php, right?
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 24th 2009 edited
     permalink
    Posted By: paulHm.. now that I am thinking about it: This would be possible modifying the smarty (or adding a bit of php) code in the default.php, right?


    I think so.

    EDIT: but it would be a bit of a dirty trick ;) you'd need a lot of {if}{elseif}
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 24th 2009
     permalink
    well, so, let's see: finally, what templates would you let customize?

    I'd say

    login.tpl
    login_success.tpl
    contact.tpl

    ( Personally I would leave out search.tpl and search_results.tpl )

    Would it be a problem if I filed this as a todo for the next version and not the upcoming one? I don't know how much is feasible without breaking stuff up for the release.
    •  
      CommentAuthorpaul
    • CommentTimeSep 24th 2009
     permalink
    No problem.

    Why would you keep search and search_results out?
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 24th 2009
     permalink
    Posted By: paulI'd create _one_ and only index.tpl and modify the content of this "frame".


    tell me more about this, what would you do in this case if you wanted a different style for the comment page?
    I've been even asked for a different style for the permalink (the optional single.tpl template)
    you know, unfortunately I can't satisfy everyone :/
    •  
      CommentAuthorNoWhereMan
    • CommentTimeSep 24th 2009
     permalink
    Posted By: paulWhy would you keep search and search_results out?


    well, just because search is quite a bit complicated. search_results would be left out only for simmetry.