Shortcodes:Themes
From e107 Wiki
e107 Wiki: English | Русский | Deutsch | Français | Magyar | Português | Български | Česky | Nederlands | Ελληνικά | Italiano | Norske | Polska | Slovenščina | Español | Svenska | Translate: Wiki | Page
Adding or overriding shortcodes with your themeYou can now create your own shortcodes or override the existing core shortcodes from your theme. Add the following line to your theme.php file:
This tells e107 that this theme will be handling all requests for the {XXXX} shortcode. You will then just add a xxxx.sc file in your root theme dir. You can now use the {XXXX} shortcode in your theme; however, you must also make sure that any code that includes {XXXX} ultimately gets parsed by $tp -> parseTemplate. For instance, you probably can include {XXXX} within $HEADER since $HEADER is parsed. You could NOT include it within theme as
See e107_files/shortcodes for sample files. Example: Create a shortcode to style individual menusSound complex? If you're comfortable with HTML and a bit of PHP the following example should help illustrate the concepts. Here is an example of a simple shortcode that will help you customize your theme by displaying the mode and style of a table. Once you know mode and style you can customize each table differently as described in Styling individual menus. Create the testshortcode.sc fileCreate the testshortcode.sc file and store it in your root theme directory (same directory as you theme.php file).
Modify your theme.php fileCreate the shortcode register at the top of your theme.
Create the global variables within your function tablestyle if you do not already have them.
What you should seeIf everything is working properly AND you uncommented the //echo $tp -> .... line above, you should see something like mode[0]=forum mode[1]=main3 style=default when you visit your forum.php page, and mode=login style=leftmenu above your left menu. Just for giggles, try using {TESTSHORTCODE} in other parts of your theme with and without the parsing statements to see what happens. Mighty and armed, you're now ready to Style your individual menus. | ||||||||||||||||||

