HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

pockets into php files

Hi, is it possible to use pockets within a php file? I need a certain pocket to appear, depending on the category, between the comments. I used the following for pockets located at the top of the website, into the file default.master.tpl:

{$categorias = array("50","56","57","58")}

{if $Category.CategoryID|in_array:$categorias }

{pocket name="pocket_01"}

{else}

{pocket name="pocket_02"}

{/if}

Now i need put this code into themes/mytheme/views/discussion/index.php

I appreciate any help.

Comments

  • R_JR_J Admin

    Look at the function.pocket.php Smarty plugin, it contains the following code:

    function smarty_function_pocket($params, $smarty) {
       if (!class_exists('PocketsPlugin')) {
           return '';
       }
    
       $name = val('name', $params);
       unset($params['name']);
    
       $result = PocketsPlugin::pocketString($name, $params);
    
       return $result;
    }
    

    Therefore, if you directly wan to use php, I guess it should work with echo PocketsPlugin::pocketString('pocket_01');

  • @R_J thanks mate for the help, it work fine :)

Sign In or Register to comment.