Jump to content

[Solved] how i can get the id of some cms pages in a array?


Recommended Posts

HI,

i need to get an array of id of some cms pages to show some custom content on them

in PS 1.4.7, i did this way:

first i override the front_controller php with the following code:

<?php
class FrontController extends FrontControllerCore
{
    public function init() {
        $id_cms_category = array();
        $id_cms_page = array();
        $id_category = array();
        $id_product = array();
    
        parent::init();

        $id_cms_category = (int)Tools::getValue('id_cms_category');
        $id_cms_page = (int)Tools::getValue('id_cms');
        $id_category = (int)Tools::getValue('id_category');
        $id_product = (int)Tools::getValue('id_product');
    
        self::$smarty->assign(array(
                                'id_cms_category' => $id_cms_category,
                                'id_cms_page' => $id_cms_page,
                                'id_category' => $id_category,                                
                                'id_product' => $id_product,
                                )
                          );
    }    
}
?>

then in the tpl

{if $page_name == 'cms' AND $smarty.get.id_cms}
    {if in_array($cms_class, array(4,10,11,12,13,14,15,16,17,18,19,20,21,22))}
       .....my content.....
    {/if}
    {/if}

i'm now  upgrading my site to the 1.5.6.1 version, but this code it is not working anymore....

i can get the $id_product variables in array and use them with no problems, but the $id_cms it is not present if i check on the console and give an empty array

 

Can anyone suggest me what i have to change to get it working for the $id_cms too?

sorry for my poor english

thanks in advance

Ariom

Edited by ariom (see edit history)
Link to comment
Share on other sites

Hi Nemo1,

firstly.....thanks for your quick answer....

 

....as simple as to drink a  glass of water.....just changing as you suggest the row in the FrontController override and in the second if statement on the tpl, solved my problem.....

i'm sorry, i'm not a developer, just a designer using some trick on the way , and the code in my previous post, (i founded it years before on a old post in the forum .....don't know what is  $cms_class i was calling there) was working fine on a PS 1.4.7.3....

 

I mark this topic a s solved.....

Edited by ariom (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...