Zen Cart Logo
Forums / Addon Sideboxes / Inserting a shoutbox into a blank sidebox.

Inserting a shoutbox into a blank sidebox.

Views: 2,611

Results 1 to 12 of 12
17 Jun 2011, 8:01 PM
#1
rendle avatar

rendle

New Zenner

Join Date:
Jun 2011
Posts:
8
Plugin Contributions:
0

Inserting a shoutbox into a blank sidebox.

Ok, this is my first post, forgive me if I have posted in the wrong forum. I am using v1.3.9a. I have a small problem getting a php shout box into a blank sidebox.

I have installed the sidebox with no problems, the issue is that I'm a php noob and I can't get the shout box into the sidebox.

I can see in my blank sidebox that I have a line of code where I can put the content of said box:

$content .= '';

and I have a line of code to insert the shoutbox in a blank page:

<?php include("sb/shoutbox.php"); ?>

(incidently the shout box does actually work), what I can't work out is how to marry the two bits of code to make the file 'shoutbox.php' the content for the blank sidebox.

If I'm missing any information please let me know and I'll try to provide it.

Thanks.

18 Jun 2011, 7:55 AM
#2
rendle avatar

rendle

New Zenner

Join Date:
Jun 2011
Posts:
8
Plugin Contributions:
0

Re: Inserting a shoutbox into a blank sidebox.

...is this even possible? :wacko:

18 Jun 2011, 8:25 AM
#3
kuroi avatar

kuroi

Totally Zenned

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

Re: Inserting a shoutbox into a blank sidebox.

You're problem is probably that you're trying to out the contents at a time when Zen Cart is trying to built a string with the content that will be output later.

From what you've written, there's also a good chance that you've inserted extra PHP tags where they're not needed.

You also haven't said where you've put your shoutbox. If the sb folder is in your site's root, you're OK, anywhere else and I wouldn't expect the file you're including to be found.

So, make sure the sb folder is in the site's root and try the following (no PHP tags)

ob_start();
include("sb/shoutbox.php");
$content .= ob_get_contents();
ob_end_clean();

What this does is open an output buffer so that your content can be assigned locally to the content variable for use at the appropriate time, then closes and empties the buffer.

18 Jun 2011, 9:27 AM
#4
rendle avatar

rendle

New Zenner

Join Date:
Jun 2011
Posts:
8
Plugin Contributions:
0

Re: Inserting a shoutbox into a blank sidebox.

Thanks a lot, I'll try that when I get home and let you know. The directory 'sb' is not in the root foder, it's in the same folder as the blank sidebox php file. I will move it to the root (by that I take it you mean the root of the zencart installation not the whole server).

:smile:

18 Jun 2011, 9:29 AM
#5
rendle avatar

rendle

New Zenner

Join Date:
Jun 2011
Posts:
8
Plugin Contributions:
0

Re: Inserting a shoutbox into a blank sidebox.

kuroi:

ob_start();
include("sb/shoutbox.php");
$content .= ob_get_contents();
ob_end_clean();


I can put this code directly between the single quote marks in:

```php
$content .= '';

?

18 Jun 2011, 11:15 AM
#6
kuroi avatar

kuroi

Totally Zenned

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

Re: Inserting a shoutbox into a blank sidebox.

No the code needs to be allowed to execute at that point, not be embedded in a string.

I'm also slightly puzzled because I would have expected the shoutbox to give you a piece of HTML to put in the template and a php file to handle the responses. Are you sure you have this the right way around?

Also, have you checked how the shoutbox will santize the data entered by your visitors to prevent your site suffer XSS hacks?

18 Jun 2011, 11:54 AM
#7
rendle avatar

rendle

New Zenner

Join Date:
Jun 2011
Posts:
8
Plugin Contributions:
0

Re: Inserting a shoutbox into a blank sidebox.

The shoutbox code was from here:
eukhost.com
, no mention of HTML as far as I can see.

18 Jun 2011, 11:55 AM
#8
rendle avatar

rendle

New Zenner

Join Date:
Jun 2011
Posts:
8
Plugin Contributions:
0

Re: Inserting a shoutbox into a blank sidebox.

kuroi:

Also, have you checked how the shoutbox will santize the data entered by your visitors to prevent your site suffer XSS hacks?

Had not checked this, perhaps it would be better to look for a better shoutbox? :huh:

18 Jun 2011, 1:12 PM
#9
kuroi avatar

kuroi

Totally Zenned

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

Re: Inserting a shoutbox into a blank sidebox.

Yes. That code looks very amateur. I suspect that it's good enough to do what it claims, but in a rather dangerous way.

In particular it places unsanitized user inputs directly into your database. Although it then strips tags before displaying the data, that's too little, too late.

18 Jun 2011, 3:46 PM
#10
rendle avatar

rendle

New Zenner

Join Date:
Jun 2011
Posts:
8
Plugin Contributions:
0

Re: Inserting a shoutbox into a blank sidebox.

Perhaps you're right. I tried a Flash shoutbox from here, but I couldn't get it to connect to the database. I'd rather use something that seems to be more solid. The client really wants a shoutbox, any suggestions?

18 Jun 2011, 4:33 PM
#11
kuroi avatar

kuroi

Totally Zenned

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

Re: Inserting a shoutbox into a blank sidebox.

Wish I had something more constructive, but this is the first time I've heard of a somebody wanting to put on an e-commerce site. So I don't have one to recommend.

Personally I'd advise against it anyway. Even if you lock it down sufficiently tightly to avoid the problems you would otherwise have with hacker and security scanning companies, it's a still great way for people to inject inappropriate content onto your client's pages and negate the benefits of any SEO activity they undertake.

19 Jun 2011, 9:12 PM
#12
rendle avatar

rendle

New Zenner

Join Date:
Jun 2011
Posts:
8
Plugin Contributions:
0

Re: Inserting a shoutbox into a blank sidebox.

Thanks for the advice, I really appreciate it. I have suggested it to the client and she has decided against the shoutbox... so, problem solved. :cool: