|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
ihabzy Smarty Rookie
Joined: 27 Jul 2012 Posts: 9
|
Posted: Sat Jul 28, 2012 6:36 pm Post subject: Problem with PHP block |
|
|
I had a block that fetch latest 3 posts from wordpress into smarty that works well in any smarty file exist in the main directory but in any .tpl file exists in a sub directory I got the following error
Code: |
( ! ) Notice: Use of undefined constant publish - assumed 'publish' in D:\wamp\www\dbk\includes\smarty\SmartyBC.class.php(456) : eval()'d code on line 2
Call Stack
# Time Memory Function Location
1 0.0012 368752 {main}( ) ..\about.php:0
2 0.0215 1748288 Smarty_Internal_TemplateBase->display( ) ..\about.php:17
3 0.0215 1748416 Smarty_Internal_TemplateBase->fetch( ) ..\smarty_internal_templatebase.php:374
4 0.0228 1808264 content_5013a61eb77dd4_88128603( ) ..\smarty_internal_templatebase.php:180
5 0.0228 1808536 Smarty_Internal_Template->getSubTemplate( ) ..\e25439d82702c0d11695d98a0275876a92d3e010.file.footer.tpl.php:98
6 0.0228 1811008 Smarty_Internal_TemplateBase->fetch( ) ..\smarty_internal_template.php:286
7 0.0243 1866864 content_5013a61ec7f5b3_49727760( ) ..\smarty_internal_templatebase.php:180
8 0.0243 1868560 smarty_php_tag( ) ..\5e26627f005912b2b757d13add851081f10d17d7.file.recentposts.tpl.php:46
9 0.0245 1881096 eval( ' $args = array( 'numberposts' => 3, 'post_status'=>publish,'post_type'=>post,'orderby'=>post_date); $postslist = get_posts( $args ); foreach ($postslist as $post) : //setup_postdata($post); echo '
'; echo ''.get_the_post_thumbnail($post->ID, array(50,38)).''; echo '
'; $subtitle = substr($post->post_title, 0, 70); if($subtitle != $post->post_title) { $subtitle = $subtitle.'...'; } echo ''.$subtitle.''; echo '
Posted on '; echo date("F d, Y", strtotime($post->post_date)).'
'; echo '
'; echo '
'; echo '
'; echo '
'; endforeach; ' ) ..\SmartyBC.class.php:456
( ! ) Notice: Use of undefined constant post - assumed 'post' in D:\wamp\www\dbk\includes\smarty\SmartyBC.class.php(456) : eval()'d code on line 2
Call Stack
# Time Memory Function Location
1 0.0012 368752 {main}( ) ..\about.php:0
2 0.0215 1748288 Smarty_Internal_TemplateBase->display( ) ..\about.php:17
3 0.0215 1748416 Smarty_Internal_TemplateBase->fetch( ) ..\smarty_internal_templatebase.php:374
4 0.0228 1808264 content_5013a61eb77dd4_88128603( ) ..\smarty_internal_templatebase.php:180
5 0.0228 1808536 Smarty_Internal_Template->getSubTemplate( ) ..\e25439d82702c0d11695d98a0275876a92d3e010.file.footer.tpl.php:98
6 0.0228 1811008 Smarty_Internal_TemplateBase->fetch( ) ..\smarty_internal_template.php:286
7 0.0243 1866864 content_5013a61ec7f5b3_49727760( ) ..\smarty_internal_templatebase.php:180
8 0.0243 1868560 smarty_php_tag( ) ..\5e26627f005912b2b757d13add851081f10d17d7.file.recentposts.tpl.php:46
9 0.0245 1881096 eval( ' $args = array( 'numberposts' => 3, 'post_status'=>publish,'post_type'=>post,'orderby'=>post_date); $postslist = get_posts( $args ); foreach ($postslist as $post) : //setup_postdata($post); echo '
'; echo ''.get_the_post_thumbnail($post->ID, array(50,38)).''; echo '
'; $subtitle = substr($post->post_title, 0, 70); if($subtitle != $post->post_title) { $subtitle = $subtitle.'...'; } echo ''.$subtitle.''; echo '
Posted on '; echo date("F d, Y", strtotime($post->post_date)).'
'; echo '
'; echo '
'; echo '
'; echo '
'; endforeach; ' ) ..\SmartyBC.class.php:456
( ! ) Notice: Use of undefined constant post_date - assumed 'post_date' in D:\wamp\www\dbk\includes\smarty\SmartyBC.class.php(456) : eval()'d code on line 2
Call Stack
# Time Memory Function Location
1 0.0012 368752 {main}( ) ..\about.php:0
2 0.0215 1748288 Smarty_Internal_TemplateBase->display( ) ..\about.php:17
3 0.0215 1748416 Smarty_Internal_TemplateBase->fetch( ) ..\smarty_internal_templatebase.php:374
4 0.0228 1808264 content_5013a61eb77dd4_88128603( ) ..\smarty_internal_templatebase.php:180
5 0.0228 1808536 Smarty_Internal_Template->getSubTemplate( ) ..\e25439d82702c0d11695d98a0275876a92d3e010.file.footer.tpl.php:98
6 0.0228 1811008 Smarty_Internal_TemplateBase->fetch( ) ..\smarty_internal_template.php:286
7 0.0243 1866864 content_5013a61ec7f5b3_49727760( ) ..\smarty_internal_templatebase.php:180
8 0.0243 1868560 smarty_php_tag( ) ..\5e26627f005912b2b757d13add851081f10d17d7.file.recentposts.tpl.php:46
9 0.0245 1881096 eval( ' $args = array( 'numberposts' => 3, 'post_status'=>publish,'post_type'=>post,'orderby'=>post_date); $postslist = get_posts( $args ); foreach ($postslist as $post) : //setup_postdata($post); echo '
'; echo ''.get_the_post_thumbnail($post->ID, array(50,38)).''; echo '
'; $subtitle = substr($post->post_title, 0, 70); if($subtitle != $post->post_title) { $subtitle = $subtitle.'...'; } echo ''.$subtitle.''; echo '
Posted on '; echo date("F d, Y", strtotime($post->post_date)).'
'; echo '
'; echo '
'; echo '
'; echo '
'; endforeach; ' ) ..\SmartyBC.class.php:456
( ! ) Fatal error: Call to undefined function get_posts() in D:\wamp\www\dbk\includes\smarty\SmartyBC.class.php(456) : eval()'d code on line 3
Call Stack
# Time Memory Function Location
1 0.0012 368752 {main}( ) ..\about.php:0
2 0.0215 1748288 Smarty_Internal_TemplateBase->display( ) ..\about.php:17
3 0.0215 1748416 Smarty_Internal_TemplateBase->fetch( ) ..\smarty_internal_templatebase.php:374
4 0.0228 1808264 content_5013a61eb77dd4_88128603( ) ..\smarty_internal_templatebase.php:180
5 0.0228 1808536 Smarty_Internal_Template->getSubTemplate( ) ..\e25439d82702c0d11695d98a0275876a92d3e010.file.footer.tpl.php:98
6 0.0228 1811008 Smarty_Internal_TemplateBase->fetch( ) ..\smarty_internal_template.php:286
7 0.0243 1866864 content_5013a61ec7f5b3_49727760( ) ..\smarty_internal_templatebase.php:180
8 0.0243 1868560 smarty_php_tag( ) ..\5e26627f005912b2b757d13add851081f10d17d7.file.recentposts.tpl.php:46
9 0.0245 1881096 eval( ' $args = array( 'numberposts' => 3, 'post_status'=>publish,'post_type'=>post,'orderby'=>post_date); $postslist = get_posts( $args ); foreach ($postslist as $post) : //setup_postdata($post); echo '
'; echo ''.get_the_post_thumbnail($post->ID, array(50,38)).''; echo '
'; $subtitle = substr($post->post_title, 0, 70); if($subtitle != $post->post_title) { $subtitle = $subtitle.'...'; } echo ''.$subtitle.''; echo '
Posted on '; echo date("F d, Y", strtotime($post->post_date)).'
'; echo '
'; echo '
'; echo '
'; echo '
'; endforeach; ' )
|
Any help !! |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Jul 29, 2012 9:24 am Post subject: |
|
|
This isnot really Smarty related. Your PHP code is invalid. The valuesin your arry must be strings.
Code: | eval( ' $args = array( 'numberposts' => 3, 'post_status'=>'publish','post_type'=>'post','orderby'=>'post_date'); |
And function get_posts seems to be undefined. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|