Talk:Templates and Shortcodes in a plugin

From e107 Wiki
Jump to: navigation, search

There needs to be a global declaration for $myplugindata in the example. I just spent 2 hours WTF'ing.

In "Adding Parameters to Shortcodes" the example has //remarks. I get errors with remarks in my short codes. Also this code has one too many (( on the left.

if ((array_key_exists("label", $parms)) {
      $text .= "E-Mail address: ";

Cameron asked to discuss before editing deveolpers code, so I am not about to change it :)


What error do you get with the // included? I've seen shortcode files with // that work fine, maye there is a bug in some new (CVS?) shortcode handler you are using. They should not cause a problem within SC_BEGIN/SC_END delimiters as this code is eval()'d so can be any valid PHP. Outside of these delimiters I would hope they do not cause a problem either - though the shortcode files i've seen only haev // before the first SC_BEGIN.

As for $myplugindata being global. It does say in the first example code that it is making the data retrieved from the database global, plus the global keywoard in the shortcode file is a bit of a giveaway that the variables that follow it need to be global.

bugrain 06Sep2006