× Warning! This forum is in archival status. New contributions may not work.
mobile and standard view
  • If I create a Publicateion I can define different Aliases. How is it possible to use for different Alias/Domains but same content different templates?

    I.e. for

    m.example.com I'd like to use the jQuery Templates, and for alias
    www.example.com I'd like to use the default Template.

    Thanks for your help in advance.

    Thomas.
  • 7 Comments sorted by
  • Vote Up0Vote Down Micz FlorMicz Flor
    Posts: 184Administrator
    we are working on the mobile site here:

    http://m.fluter.de

    at the top of front.tpl, article.tpl and section.tpl for www.fluter.de we have these lines:
    {{ if in_array(substr($smarty.server.SERVER_NAME, 0, 2), array("m.", "19")) }}
      {{ include file="fmobil2011/index.tpl" mobile=true }}
    {{ else }}
    ... default desktop here
    {{ /if }}
    

    then we have an alias for www.fluter.de for m.fluter.de

    this way newscoop accepts both URLs and delivers templates according to the URL the user wants to see.

    hope this helps, micz
  • Vote Up0Vote Down Andrey PodshivalovAndrey Podshivalov
    Posts: 1,526Member, Administrator, Sourcefabric Team
    another option:
    define new publication and assign m.example.com as alias. In mobile templates you should use at the beginning
    {{set_publication identifier="1"}}

  • Vote Up0Vote Down Micz FlorMicz Flor
    Posts: 184Administrator
    hi andrey, your solution looks clean. but i don't quite understand Smile can you elaborate a bit?

    the problem we encountered: Newscoop needs to "stay" inside the main publication with all sections and articles, but deliver content with other templates.

    initially we had a new publication called m.fluter.de with mobile templates, but this would not list content because the publication was empty and had no sections. so we decided to work with alias m. versus www. and stay within one publication.
  • Vote Up0Vote Down Andrey PodshivalovAndrey Podshivalov
    Posts: 1,526Member, Administrator, Sourcefabric Team
    hi Micz,
    the main idea is:
    1. create new publication with the same sections (number and name) as in primary publication.
    2. in each template add publication switching {{set_publication identifier="1"}}
    some restrictions:
    1. You need to manually create urls instead of use uri function.
    2. You can operate only last issue or all issues in article lists.

    may be it isn't so clear but it's just another approach Wink
  • Vote Up0Vote Down Sava TatićSava Tatić
    Posts: 113Member, Administrator, Sourcefabric Team
    I think Micz's solution is superior in the long run.

    All the best,

    Sava

    On Wed, Aug 24, 2011 at 11:35 AM, Andrey Podshivalov <
    newscoop-support@lists.sourcefabric.org> wrote:

    > **
    > hi Micz,
    > the main idea is:
    > 1. create new publication with the same sections (number and name) as in
    > primary publication.
    > 2. in each template add publication switching {{set_publication
    > identifier="1"}}
    > some restrictions:
    > 1. You need to manually create urls instead of use uri function.
    > 2. You can operate only last issue or all issues in article lists.
    >
    > may be it isn't so clear but it's just another approach [image: Wink]
    >
    >



    --
    Redesign the future of news: http://contest.sourcefabric.org

  • I tried Micz approach, but when Clicking insite ''m.example.com'' always ''www.example.com'' is referenced. How can this be solved?
    If it is a caching issue,how can cache being cleared?

    Best regards,
    Thomas.
  • If there is only one other publication you can use {{ uri }} to print löinks without hostname part.
    http://wiki.sourcefabric.org/display/NsLingo/Displaying+the+ URL

    But if you have multiple additional publications you need to construct links with such piece of code:
    {{ strip }}
    {{ assign var=publication value=$campsite->publication->name }}
    
    {{ if $publication == fluter }}
      {{ assign var="host" value="m.fluter.de" }}
    {{ elseif $publication == fluterfilm }}
      {{ assign var="host" value="m.film.fluter.de" }}
    {{ /if }}
    
    http://{{ $host }}{{ uri options=$options }}
    
    {{ /strip }}
    


    I put this in an url.tpl and use include statement. The $options variable can be set there, like
    {{ include file="url.tpl" options="article" }}