dschneid Posted September 26, 2007 Share Posted September 26, 2007 Hi. I need some basic help to make a ssi function work in my webshop. I use zen cart and have installed a simple mod called blank sidebox. this is a box where I can put basic html content in but I want to put a SSI function from my forum in it. The code in blank_sidebox.php looks like this: $content = ''; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">'; $content .= ' <!-- EDIT BELOW THIS LINE --> <table align="center"> <tr> ssi_recentPosts(); (This is where i want to put my SSI function, how do i do that? this will just output ssi_recentPosts(); in the box ) <tr> </table> <!-- EDIT ABOVE THIS LINE --> '; $content .= '</div>'; (yes I am a totally noob ) Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/ Share on other sites More sharing options...
HuggieBear Posted September 26, 2007 Share Posted September 26, 2007 Hmmm, don't Server Side Includes use a syntax like this: <!--#include virtual="../file.php" --> But if you're using PHP there shouldn't be a real need to use SSI. Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355556 Share on other sites More sharing options...
dschneid Posted September 26, 2007 Author Share Posted September 26, 2007 It's to get the recent posts from my SMF forum in my and this works but the problem here is that the recent posts actually is above the box not in it :-\ $content = ''; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">'; $content .= ' <!-- EDIT BELOW THIS LINE --> <table align="center"> <tr>'; ssi_recentPosts(); $content .= '<tr> </table> <!-- EDIT ABOVE THIS LINE --> '; $content .= '</div>'; Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355607 Share on other sites More sharing options...
HuggieBear Posted September 26, 2007 Share Posted September 26, 2007 Try changing it to this... <!-- EDIT BELOW THIS LINE --> <table align="center"> <tr>'; $data = ssi_recentPosts(); $content .= $data; $content .= '<tr> </table> <!-- EDIT ABOVE THIS LINE --> '; $content .= '</div>'; Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355609 Share on other sites More sharing options...
dschneid Posted September 26, 2007 Author Share Posted September 26, 2007 Thanks for your help, but it didn't work. Got this message: Parse error: syntax error, unexpected '/' in tpl_blank_sidebox.php on line 84 :-\ Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355629 Share on other sites More sharing options...
HuggieBear Posted September 26, 2007 Share Posted September 26, 2007 OK, well without knowing what tpl_blank_sidebox.php looks like I can't really offer much help I'm afraid. Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355633 Share on other sites More sharing options...
dschneid Posted September 26, 2007 Author Share Posted September 26, 2007 the original file looks like this: <?php // // Blank Sidebox Mod // includes/templates/templates_default/sideboxes/tpl_blank_sidebox.php $content = ''; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">'; $content .= ' <!-- EDIT BELOW THIS LINE --> <table align="center"> <tr> <tr> </table> <!-- EDIT ABOVE THIS LINE --> '; $content .= '</div>'; ?> You can see the result on www.csstemplateheaven.com in the left column. Recent posts are above the "Support" (which is blank_sidebox.php). I want recent posts to be inside this box. If I put plain html in the table it works perfect. Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355650 Share on other sites More sharing options...
HuggieBear Posted September 26, 2007 Share Posted September 26, 2007 What does ssi_recentPosts() output? Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355657 Share on other sites More sharing options...
dschneid Posted September 26, 2007 Author Share Posted September 26, 2007 recent posts from the forum Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355703 Share on other sites More sharing options...
HuggieBear Posted September 26, 2007 Share Posted September 26, 2007 In what format, an array, a string containing html? Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355704 Share on other sites More sharing options...
dschneid Posted September 26, 2007 Author Share Posted September 26, 2007 A string containing html. Sorry for beeing such a noob Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-355748 Share on other sites More sharing options...
HuggieBear Posted September 27, 2007 Share Posted September 27, 2007 I looked at the Zen Cart site and dowloaded the latest version of Blank Sidebox (for Zen Cart v1.3.7) and then visited the SMF site to look at their SSI stuff. I came up with the following: <?php /** * blank sidebox - allows a blank sidebox to be added to your site * * @package templateSystem * @copyright 2007 Kuroi Web Design * @copyright Portions Copyright 2003-2007 Zen Cart Development Team * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $ */ /* Looking at both the Zen Cart homepage and the SMF homepage I think the following should probably work. */ // Needs to be the full path to the SMF SSI.php require('/path/to/smf/forum/SSI.php'); $content = ''; $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">'; // Replace the text and HTML tags between the apostophes on lines 19 and 20. // Use as many or as few lines using this model as you need for your custom content. // If you have a multilingual site define your text in the languages/YOUR_LANGUAGE/extra_definitions/blank_sidebox_defines.php and include it as shown in line 19. // If your site is monolingual, you can put the text right here as shown on line 20 (and nobody will know!) $content .= '<p>' . ssi_recentPosts() . '</p>'; $content .= '</div>'; ?> I think the most important part to note here is probably the require of SSI.php on your page. If you're running version 1.3.0 of Zen Cart then you should still be able to use what I've posted. Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70715-noob-need-help-with-a-ssi-function/#findComment-356249 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.