Post by E@gle2313 » Fri Jan 12, 2018 7:29 pm

Hello,

I want to have a custom content_top so i can create tabs for the modules in content_top.
Well this is got, but now its on every page.
Is there something that i can say: If page then else ?

Kind regards,

Ben

Newbie

Posts

Joined
Thu Nov 23, 2017 10:15 pm

Post by straightlight » Sat Jan 13, 2018 6:44 am

Please elaborate your request. Any codes and location of these codes you could post?

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by E@gle2313 » Sun Jan 14, 2018 6:02 pm

I'm on opencart 3.0.2.0 and i'm modifying my content_top so i can alter my content_top on a specific page, in this case my homepage.
But i dont know what the code is to recognize the front page.
from:
{% for module in modules %}
{{ module }}
{% endfor %}

To:
{% if is_front_page %}
{{ modules.0 }}
{{ modules.1 }}

<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class=""><a href="#tab1" aria-controls="tab1" role="tab" data-toggle="tab" aria-expanded="true">tab1</a></li>
<li role="presentation" class=""><a href="#tab2" aria-controls="tab2" role="tab" data-toggle="tab" aria-expanded="true">tab2</a></li>
<li role="presentation" class=""><a href="#tab3" aria-controls="tab3" role="tab" data-toggle="tab" aria-expanded="true">tab3</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="tab1">
{{ modules.2 }}
</div>
<div role="tabpanel" class="tab-pane active" id="tab2">
{{ modules.3 }}
</div>
<div role="tabpanel" class="tab-pane active" id="tab3">
{{ modules.4 }}
</div>
</div>
{% else %}

{% for module in modules %}
{{ module }}
{% endfor %}

{% endif %}

Newbie

Posts

Joined
Thu Nov 23, 2017 10:15 pm

Post by straightlight » Sun Jan 14, 2018 7:45 pm

To:
{% if is_front_page %}
{{ modules.0 }}
{{ modules.1 }}
You'd need to edit your catalog/controller/common/content_top.php file to use the is_front_page key.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by E@gle2313 » Mon Jan 15, 2018 10:05 pm

owh, what should this be ??? .
I don't have many experience yet, in this department :-[

Kind regards,
Ben

Newbie

Posts

Joined
Thu Nov 23, 2017 10:15 pm

Post by E@gle2313 » Mon Jan 15, 2018 10:15 pm

just got a google and i think i have got it:

if (!isset($this->request->get['route']) || $this->request->get['route'] == 'common/home'){
$data['is_front']=1;
}

This works now :)

Newbie

Posts

Joined
Thu Nov 23, 2017 10:15 pm
Who is online

Users browsing this forum: enarco and 13 guests