× Warning! This forum is in archival status. New contributions may not work.
Open article from another publication
  • Can i have another publication, but still open articles from Publication 1? I am setting {{ set_publication identifier="1" }} in the Publication 2 article's template, but it does not work.

    Any advice would be useful.
  • 5 Comments sorted by
  • Hey sorry for the late reply - yes it is possible. The question is how do you navigate - point to article from another publication; for example in list_articles list, you can add ignore_publication="true" and the list will be able to show articles from another pub.

    Url context is crucial - in order to show some article, url of article page needs to be 

    publication-domain.com/lang_param/issue_short_name/section_short_name/article_number/article-title.htm

    As article numbers are unique through whole newscoop instance, you can simply say {{ set_article number="xyz" }} and url will be automatically set to correct pub, lang, issue, section.

    Hope this helps.. if not, please describe your use case.
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • Hey,

    Thank your for your helpfull reply. The idea is that it works on article list or in list, in generally, the problem comes whet i access the article clicking on the URL generated in that list. Here is my case:

    Newscoop instance
    -> Publication1 - example.com
    -> Publication2 - m.example.com

    The main site relays on Publicaion1 (example.com), i created the Publication2 with the alias m.example.com.

    I have a different template for m.example.com, so in the front.tpl of the Publication2 i do:

    <!-- Front page template -->
    {{ set_publication identifier="1" }}
    {{ set_issue number="1" }}

    And it works like a charm with {{ list_sections }} or {{ list_articles }} lists. The problesm appears when i access a link for an article from that list. For example:
    http://m.example.com/lng/issue/section/artid/article-title.htm
    It give me the output of error page, and not the article.tpl structure.
  • Okay can you paste your template here? Do you use {{ url options="article" }} or {{ uri options="article" }} ? Your url still points to domain of pub 2 (which may happen when you son't use absolute paths) thus it is incorrect. If you used uri instead of url, then just change that.
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • This is the front_content_tabs.tpl, which is part of the front_content.tpl, which is part of the front.tpl (which starts with {{ set_publication identifier="1" }}):

                                        <!-- .header tabs -->
                                        <div class="panel">
                                            <dl class="tabs" data-tab>
                                                <dd class="active">
                                                <a href="#important">Important</a>
                                                </dd>
                                                <dd>
                                                <a href="#ultimele">Ultimele știri</a>
                                                </dd>
                                            </dl>
                                            <div class="tabs-content">
                                                <!-- .importante -->
                                                <div class="content active" id="important">
                                                    <ul class="example-orbit-content" data-orbit>
                                                        {{ list_playlist_articles name="important" }}
                                                        <li data-orbit-slide="headline-{{ $gimme->current_list->index }}">
                                                            <div>
                                                                {{if $gimme->article->has_image(1)}}
                                                                <img src="{{ url options="image 1 width 612 height 292 crop center" }}"/>
                                                                {{/if}}
                                                                <h3><a href="{{ url options="article" }}">{{ $gimme->article->titlu }}</a></h3>
                                                                <span class="label whitelabel">{{ if $gimme->section->defined }}<a href="http://m.{{$gimme->publication->site}}/{{ $gimme->language->code }}/{{ $gimme->issue->url_name }}/{{ $gimme->section->name }}/">{{ $gimme->section->name|ucfirst }}</a>{{ /if }}</span>&nbsp;<span class="label">{{ $gimme->article->publish_date|camp_date_format:"%d.%m.%Y, %H:%i" }}</span>
                                                            </div>
                                                        </li>
                                                        {{ /list_playlist_articles }}
                                                    </ul>
                                                </div>
                                                <!-- /.importante -->
                                                <!-- .ultimele -->
                                                <div class="content" id="ultimele">
                                                    <table>
                                                        {{ list_articles length="25" order="byPublishDate desc" constraints="type is stire" }}
                                                        {{ assign var="diff" value=$smarty.now-$gimme->article->publish_date|camp_date_format:"epoch" }}

                                                        <tr>
                                                            <td style="border-bottom: 1px dotted #222222;">
                                                                <h6 {{ if $diff < "180"}} style="font-weight: bold;"{{ /if }}><a href="{{ url options="article" }}" title="{{ $gimme->article->titlu }}">{{ $gimme->article->titlu }}</a></h6>
                                                                {{ if $diff < "180"}}<span class="alert radius label">nou</span>&nbsp;{{ /if }}
                                                                <span class="secondary radius label">{{ $gimme->article->publish_date|camp_date_format:"%d.%m.%Y, %H:%i" }}</span>&nbsp;
                                                                <span class="label secondary radius"><i class="fa fa-user"></i> {{ list_article_authors }}{{ $gimme->author->first_name }} {{ $gimme->author->last_name }}{{ if !$gimme->current_list->at_end }}, {{ /if }}{{ /list_article_authors }}</span>&nbsp;
                                                                <span class="label secondary radius"><i class="fa fa-comments"></i> 3</span>&nbsp;
                                                                <span class="label secondary radius">{{ if $gimme->section->defined }}<a href="http://m.{{$gimme->publication->site}}/{{ $gimme->language->code }}/{{ $gimme->issue->url_name }}/{{ $gimme->section->name }}/">{{ $gimme->section->name|ucfirst }}</a>{{ /if }}</span>&nbsp;
                                                            </td>
                                                        </tr>
                                                        {{ /list_articles }}
                                                    </table>
                                                    <a href="#" class="button radius expand">Vezi toate știrile</a>
                                                </div>
                                                <!-- /.ultimele -->
                                            </div>
                                        </div>
                                        <!-- /.header tabs -->
                                        <br />
  • Well generally link to article from both list_playlist_articles in first tab and list_articles in second tab is correct; might be that theme for second publication is not correctly setting article template. Do you have special theme for pub 2, or just symlink to theme of pub 1?

    Also, why do you set publication param to 1? If you need same theme to run both publications, use symlink solution.

    I see sme problems here

    <a href="http://m.{{$gimme->publication->site}}/{{ $gimme->language->code }}/{{ $gimme->issue->url_name }}/{{ $gimme->section->name }}/">{{ $gimme->section->name|ucfirst }}</a> 

    first, {{ $gimme->publication->site }} - if correctly set - should return url that you need, you don't need to force it to m.{{ ... }}; second, in the same line instead of {{ $gimme->section->name }} you need to use {{ $gimme->section->url_name }}
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

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