× Warning! This forum is in archival status. New contributions may not work.
How to make custom pages
  • Hi All.
    Explain me please how to make link on custom page, like a link to users page which loads user_index.tpl 
    What i need: link on index page, which will open my custom page with some content.
    What i did: 1. in header.tpl I made  link as this <a href="/regions/>RG</a> 2. In themes folder I made regions.tpl. But I can't understand how to link link in header.tpl and regions.tpl.

    ps i tried find info in wiki and cookbook, but with zero result.
  • 4 Comments sorted by
  • Hi, to link to custom template you can use {{ url options="template regions.tpl" }}; it will construct the url of existing context plus tpl parameter (for example, if link is on article page, you will get somethnig like example.com/en/issue/section/123/Article.htm?tpl=47. If link was on issue page, it would be example.com/en/issue/?tpl=47 So you might want to turn off article, section or even issue parameter before linking to custom template - you can do it in different ways, for example inside {{ local }}{{ unset_section }}{{ url options="template regions.tpl" }}{{ /local }}).
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric

  • Hello again :)
    I founded this solve. I'm not sure right or not, but it work.
    1. In href we define which tpl file will be loaded when user will click on link. <a href="{{ uri options="template regions.tpl" }}">Click Me</a>
    2. We make tpl file with same filename which is defined in href and place it in root folder of theme.
    3. If you want keep main decoration/design u need to define which file is main of your. Put this on the top of your tpl file {{extends file="layout.tpl"}}.
    4. Also we need modify logic of breadcrumb. Breadcrumb check which tpl is loaded layout tpl or no. So, if you used  {{ extends }} You need additional condition for checking which tpl is loaded. In header.tpl replace condition on line 50 to the code shown below
              {{ if $layout == "true" }}
                {{if $gimme->template->name == "user_index.tpl"}}
                    <li><a href="{{ $view->url(['controller' => 'user', 'action' => 'index'], 'default') }}">Community</a></li>
                {{if $gimme->template->name == "regions.tpl"}}
                    <li><a href="{{ $view->url}}">Райони</a></li>

    3. Save the changes and glad to see result :)
    Your file is no different from the default tpl files (support $gimme etc.)
    Post edited by Ruslan Shilov at 2013-05-07 03:36:46
  • Vote Up0Vote Down MarinaMarina
    Posts: 296Member
    Thank you for sharing it with the community!
  • ljuba rankovic tnx for the explanation.

    Marina what i can, i'll share always. Information must be free, support should be paid ;)