1.0.8.20 - info_pages - add php code

Open to all! Ask other shopowners for help.
Post Reply
PiLLaO
Contributor
Posts: 107
Joined: Thu Nov 05, 2020 9:28 pm
Phoenix Version: v1.1.0.6
Has thanked: 53 times
Been thanked: 11 times

1.0.8.20 - info_pages - add php code

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
raiwa
Certified Developer
Posts: 1641
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: 1.0.8.20 - info_pages - add php code

Post by raiwa »

You could put the php in a hook and inject the html by JavaScript.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
PiLLaO
Contributor
Posts: 107
Joined: Thu Nov 05, 2020 9:28 pm
Phoenix Version: v1.1.0.6
Has thanked: 53 times
Been thanked: 11 times

Re: 1.0.8.20 - info_pages - add php code

Post 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.
User avatar
burt
Core Team
Posts: 4561
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 423 times

Re: 1.0.8.20 - info_pages - add php code

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.
PiLLaO
Contributor
Posts: 107
Joined: Thu Nov 05, 2020 9:28 pm
Phoenix Version: v1.1.0.6
Has thanked: 53 times
Been thanked: 11 times

Re: 1.0.8.20 - info_pages - add php code

Post 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');
?>
raiwa
Certified Developer
Posts: 1641
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: 1.0.8.20 - info_pages - add php code

Post 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.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
User avatar
zipurman
Builder
Posts: 540
Joined: Tue Oct 13, 2020 5:20 pm
Phoenix Version: v
Has thanked: 93 times
Been thanked: 162 times

Re: 1.0.8.20 - info_pages - add php code

Post by zipurman »

You can also use my shortcodes addon for this.

app.php/addons/free_addon/shortcodes_hook/
zipurman
-----------
PiLLaO
Contributor
Posts: 107
Joined: Thu Nov 05, 2020 9:28 pm
Phoenix Version: v1.1.0.6
Has thanked: 53 times
Been thanked: 11 times

Re: 1.0.8.20 - info_pages - add php code

Post 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.
zipurman wrote: Thu Jun 08, 2023 11:21 pm You can also use my shortcodes addon for this.

app.php/addons/free_addon/shortcodes_hook/
Thanks for you addon, I save for the future


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