Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.

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 Cheerleader & Troubleshooter Munich Moderator

    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');


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

    R_J
Sign In or Register to comment.