Page 1 of 1
1.0.8.20 - info_pages - add php code
Posted: Wed Jun 07, 2023 10:53 am
by PiLLaO
Hi!
I'm using v1.0.8.20
I'm trying to add php code on shipping info_pages, beacuase on august only open in the morning and I usually use a php code to auto change august timetable, but now I can't
How can I use php code inside info_pages?
Thanks in advance.
Re: 1.0.8.20 - info_pages - add php code
Posted: Wed Jun 07, 2023 11:19 am
by raiwa
You could put the php in a hook and inject the html by JavaScript.
Re: 1.0.8.20 - info_pages - add php code
Posted: Wed Jun 07, 2023 11:39 am
by PiLLaO
Hi @raiwa
Thanks for your idea, I'm trying to edit directly if is possible, if not, I will use a str_replace inside the file, I think it's easy to find the change in future.
Re: 1.0.8.20 - info_pages - add php code
Posted: Wed Jun 07, 2023 2:29 pm
by burt
Other options;
You could make a module that displays only on the relevant page (shipping), then install the module in the usual way.
Or
An other option is to drop a copy of /templates/default/includes/pages/info.php
into the overide template or whichever template you are using, then put some hardcode into it.
Re: 1.0.8.20 - info_pages - add php code
Posted: Thu Jun 08, 2023 11:25 am
by PiLLaO
Hi
@burt
Thanks for your ideas, actually I use your second option, the first option isn't possible, shipping, privacy and conditions aren't modular, I try it all the morning without results.
Code: Select all
$page = info_pages::get_page([
'p.slug' => 'shipping',
'pd.languages_id' => (int)$_SESSION['languages_id'],
]);
$breadcrumb->add($page['pages_title'], $Linker->build('shipping.php'));
require $Template->map('template_top.php', 'component');
?>
<h1 class="display-4"><?= $page['pages_title'] ?></h1>
<?= $page['pages_text'] ?>
<div class="buttonSet">
<div class="text-right"><?= new Button(IMAGE_BUTTON_CONTINUE, 'fas fa-angle-right', 'btn-light btn-block btn-lg', [], $Linker->build('index.php')) ?></div>
</div>
<?php
require $Template->map('template_bottom.php', 'component');
?>
Those pages don't have $Template->get_content('modular_page')
Code: Select all
$breadcrumb->add(NAVBAR_TITLE, $Linker->build('account.php'));
require $Template->map('template_top.php', 'component');
if ($messageStack->size('account') > 0) {
echo $messageStack->output('account');
}
?>
<div class="row"><?= $Template->get_content('account') ?></div>
<?php
require $Template->map('template_bottom.php', 'component');
?>
Re: 1.0.8.20 - info_pages - add php code
Posted: Thu Jun 08, 2023 12:01 pm
by raiwa
Place a copy of the page into the override template and add the content call there, or directly the modification you wish to add.
Re: 1.0.8.20 - info_pages - add php code
Posted: Thu Jun 08, 2023 11:21 pm
by zipurman
You can also use my shortcodes addon for this.
app.php/addons/free_addon/shortcodes_hook/
Re: 1.0.8.20 - info_pages - add php code
Posted: Fri Jun 09, 2023 9:17 am
by PiLLaO
raiwa wrote: ↑Thu Jun 08, 2023 12:01 pm
Place a copy of the page into the override template and add the content call there, or directly the modification you wish to add.
Thanks Rainer, I just place the overrided file, I think it's more easy.
Thanks for you addon, I save for the future