Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

How can i disregard parsing an area in the template ?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Kambaa
Smarty n00b


Joined: 29 Sep 2014
Posts: 2

PostPosted: Mon Sep 29, 2014 8:06 am    Post subject: How can i disregard parsing an area in the template ? Reply with quote

Hello i have a question. Think of a news page of a website. At first it displays the list of all news, and if you click one of them, that news content will be displayed on the page. I thought of writing a SINGLE TEMPLATE FILE that has both page's layout. Here's an example:
Code:

--NEWS LIST TEMPLATE START--
   <ul>
         <REPEATING SECTION START>
                <li><a href="NEWS LINK">NEWS LABEL</a></li>
        </REPEATING SECTION END>
   </ul>
--NEWS LIST END--



--NEWS CONTENT TEMPLATE START--
<div>
    <h3>NEWS TITLE</h3>
    <p>NEWS CONTENT</p>
</div>
--NEWS CONTENT TEMPLATE  END--


My problem is this: How can i write that if i'm at the news listing page, smarty should NOT PARSE the NEWS CONTENT AREA in the template? How can i disregard parsing an area in the template and NOT SHOW that area on the page?
Thank You,
Kambaa
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Sep 29, 2014 7:03 pm    Post subject: Reply with quote

If you are loading everything by default, why not hide content with CSS and javascript? Then there is no page reload on the client. Otherwise if you really want to reload and have the server side handle it:

Code:
{if $page eq "news_listing"}
   ... put news listing content ...
{else}
   ... put other content ...
{/if}


Then in the PHP code assign "page" to the page you are currently on. Something along the lines of (assuming page is passed in the url):

Code:
$smarty->assign('page', $_GET['page']);
Back to top
View user's profile Send private message Visit poster's website
Kambaa
Smarty n00b


Joined: 29 Sep 2014
Posts: 2

PostPosted: Mon Sep 29, 2014 9:02 pm    Post subject: Reply with quote

i was thinking this server side... A simple if else is really the solution... i couldn't though of that!!! i was more focused on looking for a smarty tag/method for that. Thanks....
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP