Other Template if "HOME" is clicked
  • Hello all,

    if the "Home" Button is pressed - how can NewsCoop being modified to load another template, e.g. "home.tpl" ?
    Is there a $gimme or other variable which knows there is the root being chosen?
    E.g. http://www.sourcefabric.org/ (which is "Home") in contrast to "http://www.sourcefabric.org/en/booktype" (which is a section).

    Thanks for your help in advance,
    Thomas.
    Post edited by Adam Thomas at 2012-06-10 16:11:21
  • 8 Comments sorted by
  • Vote Up0Vote Down Andrey PodshivalovAndrey Podshivalov
    Posts: 1,526Member, Administrator, Sourcefabric Team
  • Hi Thomas,

    Thanks for the question... hopefully the manual will help... I've moved this post to the Newscoop Templates forum... let us know how you get on.

    Best, Adam
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Thomas,

    By default Newscoop's home page for a particular publication is the front.tpl template for the issue with the highest number in that publication. You can link to this default home page using:
    <a href="/">Home</a>

    as shown on line 31 of the New Custodian header.tpl sub-template, included by templates such as front.tpl:

    http://code.sourcefabric.org/browse/newscoop/newscoop/install/sample_templates/the_new_custodian/templates/set_the_new_custodian/_tpl/header.tpl?hb=true
    Within that front.tpl template you have complete design flexibility and you can include whatever sub-templates that you want, so there is probably no need to make the Home button link to a non-standard template.

    To answer your second question, it is possible to link to a homepage using $gimme like this:

    http://{{ $gimme->publication->site }}/

    but this is not really necessary, because linking to / will give you the same result.

    Cheers!

    Daniel

    Post edited by Daniel James at 2012-06-11 06:52:53
  • What I really need is following:

    {{if ($smarty.server.REQUEST_URI == "/") }}{{set_issue number="1"}}{{/if}}

    But where to place this?
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Thomas,

    I think there is a simpler solution which does not involve modifying templates. If you want one particular issue to always be the homepage, regardless of any new issues that are created, give your default issue a high issue number, say 100. Then you can create issues 1 to 99 in future, but issue 100 will remain the home page because it has the highest number.

    Cheers!

    Daniel
  • Ok, I'll do.
  • Hi Thomas,

    I think there is a simpler solution which does not involve modifying templates. If you want one particular issue to always be the homepage, regardless of any new issues that are created, give your default issue a high issue number, say 100. Then you can create issues 1 to 99 in future, but issue 100 will remain the home page because it has the highest number.

    Cheers!

    Daniel



    Please note that this would be a problem for any publisher of newspaper issues. If, for example, you have a weekly newspaper, you will hit the ceiling after less than two years. And even sooner for daily newspapers. And if you have it even higher, when it is time to update it you may have forgotten what to do. 

    For websites that are not periodical like newspapers, this solution can still work. 
  • Hi all,

    generally if you want to load specific issue to home page instead of current issue, you can modify context, for example

    {{ local }}
    {{ set_issue number="xxx" }} <-- xxx is the number of desired issue
    <a href="{{ url options="issue" }}">Home</a>
    {{ /local }}
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric