Post by godly75 » Sat Nov 24, 2018 10:48 pm

Is there a way to add custom dynamic html text into a twig file via {placeholder} ?
I would love to use for example text I created in a html module or in an information page of the site.
Or is the only way hard coded in the html?

Active Member

Posts

Joined
Fri Oct 27, 2017 1:21 am

Post by OSWorX » Sun Nov 25, 2018 12:59 am

You mean with dynamic:
1. refreshing itself (mean display always another text - like in a loop)
2. text which is displayed only once per page call - is static

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by godly75 » Mon Nov 26, 2018 1:37 am

Yes static but i mean for example the content of an information page as extra to a twig file

Active Member

Posts

Joined
Fri Oct 27, 2017 1:21 am

Post by OSWorX » Mon Nov 26, 2018 3:35 am

godly75 wrote:
Mon Nov 26, 2018 1:37 am
Yes static but i mean for example the content of an information page as extra to a twig file
(1)
Then load the information text via information model inside the controller you want/need.
Then assign the content to a variable and call that inside the template.

When you know the information id it is easy.

(2)
If not, create a small new module and select there the text you want.
If you do it this way, you can change easyily the text whenever there is a need.
Beside using such a new module, you can load everything you need in the output controller and template by the corresponding module controller (= 1 line in the target controller)

(3)
Or add a new event and call that.

You see, several ways to get what you want.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by godly75 » Tue Nov 27, 2018 7:30 am

Thx I'll try to look into that

Active Member

Posts

Joined
Fri Oct 27, 2017 1:21 am

Post by godly75 » Fri Nov 30, 2018 5:07 pm

This is an information page. How can I add for example info page id=9?
{{ header }}
<div id="information-information" class="container">
<ul class="breadcrumb">
{% for breadcrumb in breadcrumbs %}
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
{% endfor %}
</ul>
<div class="row">{{ column_left }}
{% if column_left and column_right %}
{% set class = 'col-sm-6' %}
{% elseif column_left or column_right %}
{% set class = 'col-sm-9' %}
{% else %}
{% set class = 'col-sm-12' %}
{% endif %}
<div id="content" class="{{ class }}">{{ content_top }}
<h1>{{ heading_title }}</h1>
{{ description }}{{ content_bottom }}</div>
{{ column_right }}</div>
</div>
{{ footer }}

Active Member

Posts

Joined
Fri Oct 27, 2017 1:21 am

Post by OSWorX » Fri Nov 30, 2018 6:29 pm

godly75 wrote:
Fri Nov 30, 2018 5:07 pm
This is an information page. How can I add for example info page id=9?
As suggested in my former answer.
Anything else result in custom, paid job.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by godly75 » Sat Dec 01, 2018 8:32 pm

I've send you some email but no reply?

Active Member

Posts

Joined
Fri Oct 27, 2017 1:21 am

Post by godly75 » Sat Dec 01, 2018 8:34 pm

So the question stays, how can I reuse text from an existing info page with the _id=X number?
Is this custom or can I use this function?
How are info pages shown?

Active Member

Posts

Joined
Fri Oct 27, 2017 1:21 am

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by ocmta » Sun Dec 02, 2018 9:54 pm

First you should load information in the controller of the page where you want to use it, something like this:

Code: Select all

$information_id = 9;
$this->load->model('catalog/information');
$information = $this->model_catalog_information->getInformation($information_id);
if ($information) {
	$data['information_title'] = $information['title'];
	$data['information_description'] = $information['description'];
} else {
	$data['information_title'] = '';
	$data['information_description'] = '';
}
Then you can use information title and description in twig template, like this:

Code: Select all

{{ information_title }}
{{ information_description }}

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am

Who is online

Users browsing this forum: No registered users and 15 guests