Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Delete some elements from specific pages.

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Adi
Smarty n00b


Joined: 30 Jul 2020
Posts: 4

PostPosted: Thu Jul 30, 2020 9:17 am    Post subject: Delete some elements from specific pages. Reply with quote

Hi,
On pages where body has classes like: 'shop_news_list' and 'shop_news' I am trying to delete elements such as <footer> tag, menu row etc. The way I want to do this is by putting those elements in between if statement. For example:
Code:

{if !($body_class == ''shop_news_list' || $body_class == 'shop_news')}
<footer class="footer row">
        ...
</footer>
{/if}

However it doesn't work or makes an element disappear from every page. Is there any other way I can do this or maybe you know how can I check if body has particular class. [/code]
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1646

PostPosted: Thu Jul 30, 2020 11:14 am    Post subject: Reply with quote

Use different templates for different pages, see also template inheritance.

https://www.smarty.net/docs/en/language.function.extends.tpl
https://www.smarty.net/docs/en/language.function.include.tpl
Back to top
View user's profile Send private message
Adi
Smarty n00b


Joined: 30 Jul 2020
Posts: 4

PostPosted: Thu Jul 30, 2020 12:59 pm    Post subject: Reply with quote

Unfortunately I can not create new files to use them as new templates.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1646

PostPosted: Thu Jul 30, 2020 9:50 pm    Post subject: Reply with quote

Then this is not a Smarty problem.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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