Help – Smarty Simple XML Plugin – Object of class Smarty could not be converted
-
I am in the process of building a wordpress plugin that reads an xml file, styles it with a smarty template, and posts on wordpress via a shortcode. I am currently getting the following error directly below the content outputed by Smarty:
Catchable fatal error: Object of class Smarty could not be converted to string in /home/unionand/public_html/dirtypeteindustries/wp-includes/shortcodes.php on line 151
Here is the code from my wordpress plugin file that outputs this:
//Format and Export HTML with Smarty function vehicle_shortcode(){ // put full path to Smarty.class.php define('SMARTY_DIR', '/home/unionand/public_html/dirtypeteindustries/wp-content/plugins/showroom-syndication/libs/'); require_once(SMARTY_DIR . 'Smarty.class.php'); $smarty = new Smarty(); $smarty->template_dir = '/home/unionand/public_html/dirtypeteindustries/wp-content/plugins/showroom-syndication/templates/'; $smarty->compile_dir = '/home/unionand/public_html/dirtypeteindustries/wp-content/plugins/showroom-syndication/templates_c/'; $smarty->cache_dir = '/home/unionand/public_html/dirtypeteindustries/wp-content/plugins/showroom-syndication/cache/'; $smarty->config_dir = '/home/unionand/public_html/dirtypeteindustries/wp-content/plugins/showroom-syndication/configs/'; $xml = simplexml_load_file('https://dirtypeteindustries.com/wp-content/plugins/showroom-syndication/list.xml'); $smarty->assign("xml", $xml); //display file needs to be the style variable from admin panel $smarty->display("list.html"); // Return NOT echo: return $smarty; }
Below is the action to create the shortcode:
add_shortcode('vehicles', array(&$ddc_showroomSyndicate, 'vehicle_shortcode'));
Everything seems to be working properly, just don’t know how to get rid of this error. Any ideas? Thanks in advance, let me know if you need any more info. Any help is greatly appreciated. Pete
- The topic ‘Help – Smarty Simple XML Plugin – Object of class Smarty could not be converted’ is closed to new replies.