How to create a block and insert there PHP? I need to insert the name of the section in which the user is. Help me please.
[quote name='Psinetron' timestamp='1349347578' post='146327']
How to create a block and insert there PHP? I need to insert the name of the section in which the user is. Help me please.
[/quote]
What do you mean under “name of the section”? Page title?
name of the section = User Group ?
Sorry for my English. But in Russian forum is not smart people. Name of the section = Perhaps this group of products.
Green power - this is my HTML block. How to insert a block of HTML PHP? Variable to a group of products?
2drahos.istvan, Yes, It’s a title of page too.
Hi!
So the easiest way, to get the page title without any PHP, is to create a wrapper template file. For example you put a file named “section_name.tpl” into the /skins/SKINNAME/customer/blocks/wrappers and insert this code:
<br />
{$page_title}<br />
```<br />
And after that, you have to add a "HTML block" with any content, and set the block wrapper to the section_name wrapper. I hope it will work <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)"> This is not the best solution, but it is the easiest, I think <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)"><br />
If you need a more sophisticated solution, please let me know.
Thank you. It works. But not quite the way it should. My code is this:
{foreach from=$breadcrumbs item="bc" name="bcn" key="key"}
{if $iiii==2}
{/if}
{/foreach}
This is not correct. How can I improve the code?
[quote name='Psinetron' timestamp='1349675113' post='146586']
Thank you. It works. But not quite the way it should. My code is this:
{foreach from=$breadcrumbs item="bc" name="bcn" key="key"}
{if $iiii==2}
{/if}
{/foreach}
This is not correct. How can I improve the code?
[/quote]
Hi there!
As I see, you would like to print the last element of the breadcrumb array. I hope this code will do it for you:
{foreach from=$breadcrumbs item="bc" name="bcn" key="key"}
{if $smarty.foreach.bcn.last}
{$bc.title|unescape|strip_tags|escape:"html"}
{/if}
{/foreach}
More info about the Smarty foreach is here: [url=“{foreach},{foreachelse} | Smarty”]{foreach},{foreachelse} | Smarty
Thank you!