Jump to content

please explain this code, params array


emideli

Recommended Posts

i am reading ps dev book, and on the topic of creating frontcontrollers with SEO friendly URL, i am not understanding the purpose of following code

 

{assign var=params value=[
'module_action' => 'list',
'id_product'=> $smarty.get.id_product
]}
 
why are we creating params array and what is module_action
 
----
 
full code
 
<div class="rte">
{assign var=params value=[
'module_action' => 'list',
'id_product'=> $smarty.get.id_product
]}
<a href="{$link->getModuleLink('mymodcomments', 'comments',
$params)}">
{l s='See all comments' mod='mymodcomments'}
</a>
</div>

 

 

thanks

Link to comment
Share on other sites

Below code is used to create (assign) a smarty variable $params so that you can this in code after that,

{assign var=params value=[
'module_action' => 'list',
'id_product'=> $smarty.get.id_product
]}

module_action is one of the keys of value of $params  

 

so you can access it like $params['module_action'] and the value should 'list'

 

 

Link to comment
Share on other sites

No idea where is your sample code comes from and for what purpose.

It seems used to pass a parameters to module hook. You can define and pass any parameters you want.

Who knows what the author was trying to do with that sample code.

You should find out from the book you are reading?
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...