Forums / General Questions / blank sidebox

blank sidebox

Locked

Started by t0minit on 12 Nov 2007, 3:55 PM · Views: 5,307

Results 21 to 30 of 30
This thread is locked. New replies are disabled.
23 Jun 2008, 8:55 PM
#21
tapper avatar

tapper

Zen Follower

Join Date:
Nov 2007
Location:
Upstate NY
Posts:
233
Plugin Contributions:
0

blank sidebox

I'm trying to add an RSS feed to the blank sidebox. RSS Scroller didn't work for me (and bad install instructions: tess you to put placing full HTML header into main_page defined page??? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tra"http://www.w3.org/TR/xhtml1/onal.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http, etc).
The other RSS mods I've found provide my store as a feed, rather than put external feeds on my page. I decided to try getting a feed from Magpie into the blank sidebox.

To get Magpie working, I think I need guidance about placing PHP code that calls include files and has required directories.

I have tried adding it in tpl_sidebox and/or sidebox_defines, but when I enable the code the center column loads and then the page breaks. I think the problem may be the include files. This code relies on 4 include files and 2 directories. I can put static text in there (content .= 'magpie'), and I've made calls to the zen database from a blank sidebox, but I don't know about placement for these include and required dirs.

I tried placing the dirs and inc files in includes/templates/sideboxes (where the tpl_file is located), and in includes/languages/english/extra_definitions (where the sidebox_defines file is located).

This is the code that works in a regular php page:

include('./rss_fetch.inc');
error_reporting(0);
$url = "anyrssfeed";
$rss = fetch_rss($url);
if ($rss) {
$items = array_slice($rss->items, 0, 15);
foreach ($items as $item) {
echo "<p><a href="" .$item['link']. "">"
.$item['title']. "</a></p>";
}
}
@ini_restore('error_reporting');

I have tried various combinations of the code below (with more and less content' assigns), and moved the include command to the top of the page, but whenever I leave this code active the home page loads the center column and then breaks.

$content .= '<p>' . TEXT_MAGPIE_SIDEBOX . '</p>';
error_reporting(0);
$content .= $url = "rssfeed";
$rss = fetch_rss($url);
if ($rss) {
$content .= $items = array_slice($rss->items, 0, 15);
$content .= foreach ($items as $item) {
$content .= echo "<p><a href="" .$item['link']. "">"
$content .= .$item['title']. "</a></p>";
$content .= '</div>';

23 Jun 2008, 8:59 PM
#22
tapper avatar

tapper

Zen Follower

Join Date:
Nov 2007
Location:
Upstate NY
Posts:
233
Plugin Contributions:
0

Re: blank sidebox

I'm trying to add an RSS feed to the blank sidebox. RSS Scroller didn't work for me (and bad install instructions: tells you to put full HTML header and footer into main_page defined page??? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tra"http://www.w3.org/TR/xhtml1/onal.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http, etc).
The other RSS mods I've found provide my store as a feed, rather than put external feeds on my page. I decided to try getting a feed from Magpie into the blank sidebox.

To get Magpie working, I think I need guidance about placing PHP code that calls include files and has required directories.

I have tried adding it in tpl_sidebox and/or sidebox_defines, but when I enable the code the center column loads and then the page breaks. I think the problem may be the include files. This code relies on 4 include files and 2 directories. I can put static text in there (content .= 'magpie'), and I've made calls to the zen database from a blank sidebox, but I don't know about placement for these include and required dirs.

I tried placing the dirs and inc files in includes/templates/sideboxes (where the tpl_file is located), and in includes/languages/english/extra_definitions (where the sidebox_defines file is located).

This is the code that works in a regular php page:

include('./rss_fetch.inc');
error_reporting(0);
$url = "anyrssfeed";
$rss = fetch_rss($url);
if ($rss) {
$items = array_slice($rss->items, 0, 15);
foreach ($items as $item) {
echo "<p><a href="" .$item['link']. "">"
.$item['title']. "</a></p>";
}
}
@ini_restore('error_reporting');

I have tried various combinations of the code below (with more and less content' assigns), and moved the include command to the top of the page, but whenever I leave this code active the home page loads the center column and then breaks.

$content .= '<p>' . TEXT_MAGPIE_SIDEBOX . '</p>';
error_reporting(0);
$content .= $url = "rssfeed";
$rss = fetch_rss($url);
if ($rss) {
$content .= $items = array_slice($rss->items, 0, 15);
$content .= foreach ($items as $item) {
$content .= echo "<p><a href="" .$item['link']. "">"
$content .= .$item['title']. "</a></p>";
$content .= '</div>';

23 Jun 2008, 10:25 PM
#23
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: blank sidebox

I can see a number of potential problems with this:

  1. it's not clear what you mean by moving the include statement to the top of the page.
  2. you close a DIV tag that doesn't appear to have been opened
  3. you open an IF statement but don't appear to close it
  4. you start a FOREACH statement but don't terminate it
  5. one of your additions to the $content variable is lacking a line terminator (semi-colon) and
  6. the one that follows starts with an illegal character (a full stop)The first may cause the problem depending upon how you've done this, all of the rest certainly would cause this problem. But PHP is good at telling you exactly where the problem has occurred, so I'd recommend fixing each of the above, and if there's still a problem, paying close attention to the detail of the error message that follows and explains the breakage.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

24 Jun 2008, 3:42 PM
#24
tapper avatar

tapper

Zen Follower

Join Date:
Nov 2007
Location:
Upstate NY
Posts:
233
Plugin Contributions:
0

Re: blank sidebox

Thanks so much! Those weren't the problem, but you made me get off my duff and go back to the basics. I was overworking the code: I just needed to remove a ./ and insert ONE $content assignment.

I added the original php code from the stand-alone website with no $content assignments, just to see if it would run without breaking the page. I had to remove the ./ from the include(./'rss_fetch.inc'), and left in the echo. Without a $content assignment it worked great, but the echo seemed to put the content in the previous element: in this case, the Manufacturers box was above it, so the RSS links went in there.

When I added the php to the sidebox_defines, it threw the RSS feed into the header and replaced everything across the top of the page. So I put it back in the tpl file.

It works beautifully, so here is the method in case anyone else needs it.

If you need to add RSS headlines to zen cart, here's how:

  1. Download Magpie http://magpierss.sourceforge.net/
  2. Get the Blank Sidebox mod, change file names and names in code as directed in the instructions
  3. Put the magpie app files into
    /yourstore/includes/templates/YOUR_TEMPLATE_NAME/sideboxes.
    magpie files: rss_cache.inc, rss_fetch.inc, rss_parse.inc, rss_utils.inc
    magpie dir: extlib.
  4. Create a dir called "cache" in the same sideboxes directory.
  5. Add the following code to the tpl_magpie_sidebox.php (or whatever you called the tpl_blank_sidebox.php file), also in the same sideboxes directory:

The first $content='' clears that variable so the previous sidebox's content doesn't appear in this box.
The "items, 0, 5" is where you set the number of headlines to return. This one returns 5.

<?php $content = ''; include('rss_fetch.inc'); error_reporting(0); $url = "http://rss.cnn.com/rss/cnn_topstories.rss"; $rss = fetch_rss($url); if ($rss) { $items = array_slice($rss->items, 0, 5); foreach ($items as $item) { $content .= "<p><a href=\"" .$item['link']. "\"target=\"_blank\">" .$item['title']. "</a></p>"; } } @ini_restore('error_reporting'); ?>
24 Jun 2008, 4:32 PM
#25
tapper avatar

tapper

Zen Follower

Join Date:
Nov 2007
Location:
Upstate NY
Posts:
233
Plugin Contributions:
0

Re: blank sidebox

One question I have: the best place to put the magpie files. I put them in the sideboxes dir because that's where the calling page is located, but that probably isn't right.

Is this the best place? Is there a directory in zen that is the preferred location for this kind of 3rd-party/non zen content? I may be asked to add EZ Pages with more content, and it certainly isn't a good idea to have duplicate files around.

Thanks

--Pat

7 May 2009, 3:01 AM
#26
xtreme_exhibits avatar

xtreme_exhibits

New Zenner

Join Date:
Nov 2007
Posts:
17
Plugin Contributions:
0

Re: blank sidebox

I hope this is the right place to put this question.

I recently installed Blank Sidebox and put in a description of the site. You can see it on the right column of each page.
http://www.creationsremembered.com/

But now, underneath the blank sidebox, another sidebox appears with the title "Blank Sidebox" and then it has all the links that the "Information" sidebox contains. If i turn off the blank sidebox module then the blank sidebox disappears as does this repeating information sidebox. So they are linked somehow...

I'm barely a novice with all this but I've gone over and over everything and can't figure out what i did to screw up the installation so bad.

Thank you for any help or suggestions you may be able to offer.

7 May 2009, 8:20 AM
#27
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: blank sidebox

Looking at your site, the custom text and image are completely outside the blank sidebox and the sidebox content isn't being reset and is instead re-displaying that of the previous box that was output.

Could you tell us more about how you installed the mod and added your custom code. Or maybe better still zip up your versions of the two files and upload them here.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

11 May 2009, 5:21 PM
#28
oriontool avatar

oriontool

New Zenner

Join Date:
Apr 2009
Posts:
52
Plugin Contributions:
0

Re: blank sidebox

Hello,

I have installed the blank sidebox on my site: http://www.earphoneguy.com.

I have figured out how to edit the box, but I've obviously done something wrong. I am trying to have an image displayed in the sidebox but the only that is showing is the HTML.:oops:

Can someone please tell me what I've done wrong and how to correct it?

Thanks in advance!

Professional accessories for your two-way radio.
The Earphone Guy

11 May 2009, 6:20 PM
#29
oriontool avatar

oriontool

New Zenner

Join Date:
Apr 2009
Posts:
52
Plugin Contributions:
0

Re: blank sidebox

Resolved. Thanks!

Professional accessories for your two-way radio.
The Earphone Guy

22 Jun 2009, 9:10 AM
#30
muzz avatar

muzz

Totally Zenned

Join Date:
Mar 2009
Location:
Australia
Posts:
604
Plugin Contributions:
0

Re: blank sidebox

Hi All,

I couldn't find a blank Sidebox support page so I thought I would post in here because it may help someone else out.

Adding Flash to Blank Sidebox.

I installed the SWFobject as I'm using a flash banner.

The http was edited to https as I use an SSL certificate.

http://code.google.com/p/swfobject/wiki/documentation

Flash Code added to blank sidebox:

<?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 $ */ $content = 'remove text here or edit as you wish'; $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 .= ''; $content .= '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="140" height="260" id="yourfile"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="yourfilelocation/anywhere/yourfile.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="yourfilelocation/anywhere/yourfile.swf" quality="high" bgcolor="#ffffff" width="140" height="260" name="yourfile" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" /> </object>'; $content .= '</div>'; ?>

That wasn't the plan!