Set Content Module per Template

Open to all! Ask other shopowners for help.
Post Reply
azpro
Contributor
Posts: 177
Joined: Fri Nov 06, 2020 8:25 am
Phoenix Version: v1.1.0.6
Has thanked: 30 times
Been thanked: 34 times

Set Content Module per Template

Post by azpro »

Hi all,

After updating to 1.1.0.6. I started to explore more of the templating possibilities. Easily switching between templates brought me to a question.

Is it possible to have a Content Module (eg carrousel) only assigned to a particular template? So duplicate and rename the carrousel stuff and assign to template.

Tnx! Arjan


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Set Content Module per Template

Post by burt »

Upload the TPL file of the Module to the templates.

EG:
/includes/modules/content/index/templates/tpl_carousel.php

TO `first_template`:
/templates/first_template/includes/modules/content/index/tpl_carousel.php

AND TO `another_template`:
/templates/another_template/includes/modules/content/index/tpl_carousel.php

Now you have the Carousel being displayed by two separate templates.

If you do not want that Carousel in `first_template`, just change the `first_template` file to "blank" (ie the file IS there [thus overriding the Core or Addon File], but has NO content. If it has NO content...it won't show.

That's a way, it might not be the perfect way or the only way.
I don't know if there might be an addon that makes this process easier?
I am not here to build for you.
I am here to build with you. Let's help each other.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Set Content Module per Template

Post by burt »

Importantly, notice that when you upload a TPL file to a Template it does not need the /templates directory;

EG:
/includes/modules/content/index/templates/tpl_carousel.php

TO `first_template`:
/templates/first_template/includes/modules/content/index/tpl_carousel.php <-- /templates not needed here
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply