Creating diferrent Sections and Menu
  • Vote Up0Vote Down LorenaLorena
    Posts: 3Member
    I'm making a news webpage using campsite. I would like to know how to modify the sections in the homepage separately, so to place within the same section a background without changing the others. I also want to put into the same section 3 secondary news below the main news. I also want to know how I can creat a secundary menu without changing the top menu.
  • 4 Comments sorted by
  • Hi Lorena,

    It looks to me more like a layout issue rather than a Campsite
    specific question.

    Campsite template engine is Smarty-based, so you can create your
    template files (.tpl) with practically any layout you want and just
    embed Campsite template tags to pull the data and place it wherever
    you need. For example:

    <table>
    {{ local }}
    {{ set_section number=10 }}
    {{ list_articles name="articles" length="4" constraints="OnFrontPage
    is on" ignore_issue=true }}
    <tr>
    <td>
    {{ if $campsite->current_list->at_beginning }}
    <div class="main_article_style">
    <p class="article_date">{{
    $campsite->article->publish_date|camp_date_format:'%M %D, %Y %h:%i'
    }}</p>
    <h2 class="article_title"><a href="{{ uri options="article
    template article.tpl" }}">{{ $campsite->article->name }}</a></h2>
    <p class="article_text">{{ $campsite->article->intro }}</p>
    <p class="link"><a href="{{ uri options="article template
    article.tpl" }}">Read more</a></p>
    </div>
    {{ else }}
    <div class="ordinary_article_style">
    <p class="article_date">{{
    $campsite->article->publish_date|camp_date_format:'%M %D, %Y %h:%i'
    }}</p>
    <h2 class="article_title"><a href="{{ uri options="article
    template article.tpl" }}">{{ $campsite->article->name }}</a></h2>
    <p class="link"><a href="{{ uri options="article template
    article.tpl" }}">Read more</a></p>
    </div>
    {{ /if }}
    </td>
    </tr>
    {{ /list_articles }}
    {{ /local }}
    </table>


    Code above is quite simple but it helps to illustrate how something
    like "to put into the same section 3 secondary news below the main
    news" may be done:

    Line below define which section the articles will be fetched from.
    {{ set_section number=10 }}

    Then we declare the list. Length is 4 articles because that is what we
    want (main and 3 more). We use OnFrontPage but it may well be
    OnSection depending on what kind of page you are building.
    {{ list_articles name="articles" length="4" constraints="OnFrontPage
    is on" ignore_issue=true }}

    Now we ask if we are at the beginning of the list, that is 1st element
    (main news), if so it prints article publish date, title and intro
    with specific styling. Here I am assuming default ordering, you can
    read more about ordering conditions at
    http://code.campware.org/manuals/campsite/3.3/index.php?id=7 5
    {{ if $campsite->current_list->at_beginning }}

    If not, it prints only article publish date and title for the other 3
    news (2nd to 4th in the list) with specific styling as well.

    And that's it. As I said, code in the example is basic html, you can
    use instead xml, tableless coding, whatever, and structure your
    document to fit your needs.

    As for the secondary menu, it depends on how you structure the content
    within Campsite, it might be built from sections list, topics list.

    Hope this helps.



    On Thu, May 6, 2010 at 3:24 PM, Lorena
    <campsite-support@lists.sourcefabric.org> wrote:
    >
    > I'm making a news webpage using campsite. I would like to know how to modify the sections in the homepage separately, so to place within the same section a background without changing the others. I also want to put into the same section 3 secondary news below the main news. I also want to know how I can creat a secundary menu without changing the top menu.
    >


    --
    /holman
  • Vote Up0Vote Down LorenaLorena
    Posts: 3Member
    Thank you Holman i try to use the table but it only recognize one article and repeat it 3 times... do you have a different code than could work with that?
  • Lorena, may you please send the entire template file so that I can check if there is something wrong. Code works ok to me in Campsite 3.3.5. Make sure you have any articles in the section you set and at least 1 article with "Show article on front page" checked.
  • Vote Up0Vote Down LorenaLorena
    Posts: 3Member
    Hello Holman thank you for your help here is the code I'm pretty sure I'm doing something wrong but I don't know what. Thank you very much again!

    <div class="teaserframe teaserframe-{{ $campsite->section->number }}">

    <div class="teaserframeinner">
    <div class="teaserheadsection">

    <a href="{{ uri options="section template section.tpl" }}">{{ $campsite->section->name }}</a></div>
    <!-- class="teaserheadsection" -->
    <div class="teasercontent content">

    <h2 class="title title_big"><a href="{{ uri options="article template article.tpl" }}">{{ $campsite->article->name }}</a></h2></div>

    {{ if $campsite->article->has_image(200) }}

    <!-- Big banner image -->

    <div class="teaserimg_big">

    <a href="{{ uri options="template article.tpl" }}"><img src="/get_img.php?{{ urlparameters options="image 200" }}"/></a>

    </div><!-- .teaserimg_big -->

    {{ /if }}

    {{ if $campsite->article->has_image(201) }}

    <!-- Big square image -->

    <div class="teaserimg_med">

    <a href="{{ uri options="template article.tpl" }}"><img src="/get_img.php?{{ urlparameters options="image 201" }}"/></a>

    </div><!-- .teaserimg_med -->

    {{ /if }}

    <div class="teasercontent content">

    <p class="text">{{ $campsite->article->Lead_and_SMS }}</p>

    <ul class="links">

    <li><a href="{{ uri options="article template article.tpl" }}">Read more<!--Read more--></a>

    {{ include file="classic/tpl/comments-link.tpl" }}

    </ul>
    <table border="0" cellpadding="0" cellspacing="2">
    {{ local }}
    {{ set_section number=20 }}
    {{ list_articles name="articles" length="4" constraints="OnFrontPage
    is on" ignore_issue=true }}
    <tr>
    <td><div class="teaserframe teaserframe-{{ $campsite->section->number }}">

    <div class="teaserframeinner">
    <div class="teaserheadsection"></div>
    <div class="teasercontent content">

    <h2 class="title title_big"><a href="{{ uri options="article template article.tpl" }}">{{ $campsite->article->name }}</a></h2></div>

    {{ if $campsite->article->has_image(200) }}

    <!-- Big banner image -->

    <div class="teaserimg_big">

    <a href="{{ uri options="template article.tpl" }}"><img src="/get_img.php?{{ urlparameters options="image 200" }}"/></a>

    </div><!-- .teaserimg_big -->

    {{ /if }}

    {{ if $campsite->article->has_image(201) }}

    <!-- Big square image -->

    <div class="teaserimg_med">

    <a href="{{ uri options="template article.tpl" }}"><img src="/get_img.php?{{ urlparameters options="image 201" }}"/></a>

    </div><!-- .teaserimg_med -->

    {{ /if }}

    <div class="teasercontent content">

    <p class="text">{{ $campsite->article->Lead_and_SMS }}</p>

    <ul class="links">

    <li><a href="{{ uri options="article template article.tpl" }}">Read more<!--Read more--></a>

    {{ include file="classic/tpl/comments-link.tpl" }}

    </ul>
    </td>
    <td><div class="teaserframe teaserframe-{{ $campsite->section->number }}">

    <div class="teaserframeinner">
    <div class="teaserheadsection"></div><div class="teasercontent content">

    <h2 class="title title_big"><a href="{{ uri options="article template article.tpl" }}">{{ $campsite->article->name }}</a></h2></div>

    {{ if $campsite->article->has_image(200) }}

    <!-- Big banner image -->

    <div class="teaserimg_big">

    <a href="{{ uri options="template article.tpl" }}"><img src="/get_img.php?{{ urlparameters options="image 200" }}"/></a>

    </div><!-- .teaserimg_big -->

    {{ /if }}

    {{ if $campsite->article->has_image(201) }}

    <!-- Big square image -->

    <div class="teaserimg_med">

    <a href="{{ uri options="template article.tpl" }}"><img src="/get_img.php?{{ urlparameters options="image 201" }}"/></a>

    </div><!-- .teaserimg_med -->

    {{ /if }}

    <div class="teasercontent content">

    <p class="text">{{ $campsite->article->Lead_and_SMS }}</p>

    <ul class="links">

    <li><a href="{{ uri options="article template article.tpl" }}">Read more<!--Read more--></a>

    {{ include file="classic/tpl/comments-link.tpl" }}

    </ul></td>
    <td><div class="teaserframe teaserframe-{{ $campsite->section->number }}">

    <div class="teaserframeinner">
    <div class="teaserheadsection"></div><div class="teasercontent content">

    <h2 class="title title_big"><a href="{{ uri options="article template article.tpl" }}">{{ $campsite->article->name }}</a></h2></div>

    {{ if $campsite->article->has_image(200) }}

    <!-- Big banner image -->

    <div class="teaserimg_big">

    <a href="{{ uri options="template article.tpl" }}"><img src="/get_img.php?{{ urlparameters options="image 200" }}"/></a>

    </div><!-- .teaserimg_big -->

    {{ /if }}

    {{ if $campsite->article->has_image(201) }}

    <!-- Big square image -->

    <div class="teaserimg_med">

    <a href="{{ uri options="template article.tpl" }}"><img src="/get_img.php?{{ urlparameters options="image 201" }}"/></a>

    </div><!-- .teaserimg_med -->

    {{ /if }}

    <div class="teasercontent content">

    <p class="text">{{ $campsite->article->Lead_and_SMS }}</p>

    <ul class="links">

    <li><a href="{{ uri options="article template article.tpl" }}">Read more<!--Read more--></a>

    {{ include file="classic/tpl/comments-link.tpl" }}

    </ul></td>
    </tr>
    {{ /list_articles }}
    {{ /local }}
    </table>
    </div><!-- .teasercontent content -->

    </div><!-- .teaserframeinner -->

    </div><!-- .teaserframe -->
    <div class="teaserheadinner">



    {{ $campsite->article->publish_date|camp_date_format:'%M %D, %Y %h:%i' }}

    {{ include file="classic/tpl/topic-list.tpl" }}

    </div>