TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 458
  • Total: 458

Integrating cbox into TP

Started by nikljones, September 16, 2009, 09:33:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nikljones

Hey,

Crip turned me on to cbox to use on my site. It works great in a block but am trying to integrate it so that the user don't have to sign in. In other words it will recognize their current username in cbox. Here's the pertients:

Link to my site: http://www.3csfnf.com
SMF version: SMF 1.1.10
TP version: 1.0 b4
Theme name and version: Custom by Crip
Browser Name and Version: Opera 10.0
Mods installed: SMF Media Gallery, SMF Links, SMF Articles
Related Error messages: Javascript error "You do not have permission to post on this Cbox. The Cbox may be misconfigured."

The code I'm using in an HTML block works fine with out integration.

What i don't know is what to replace $name with I guess. Any help is appreciated.

Quote

<!-- BEGIN CBOX - www.cbox.ws - v001 -->
<DIV id="cboxdiv" style="text-align: center; line-height: 0">
<DIV><IFRAME frameborder="0" width="100%" height="209" src="http://www7.cbox.ws/box/?boxid=845&amp;boxtag=wwacy1&amp;sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain" style="border:#FFFFFF 1px solid;" id="cboxmain"></IFRAME></DIV>
<DIV><IFRAME frameborder="0" width="100%" height="91" src="http://www7.cbox.ws/box/?boxid=845&amp;boxtag=wwacy1&amp;sec=form&amp;nme=&lt;?=urlencode($name])?&gt;&amp;nmekey=&lt;?=md5('PrivateKey'.$name)?&gt;" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#FFFFFF 1px solid;border-top:0px" id="cboxform"></IFRAME></DIV>
</DIV>
<!-- END CBOX -->













Crip

Sorry I can't help out Nick , it's a Good chat if you can get it integrated .. seems it wants to go in the Header or Footer if I remember right ?

BB,
Crip~
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



IchBin

Looks like you're mixing PHP in the html? I'm not sure what exactly your code is doing, but if you need to pass a username from SMF into the $name variable, all you need to do is pass the $context['user']['name'] variable instead of $name.

But this means you have to make all that code work in a PHP article or block. You would need to declare $context as global.
global $context;

And then put your html in an echo statement. But from the looks of it, you already have a mix of PHP, I can't really tell.

nikljones

Quote from: IchBinâ„¢ on September 17, 2009, 12:29:21 AM
Looks like you're mixing PHP in the html? I'm not sure what exactly your code is doing, but if you need to pass a username from SMF into the $name variable, all you need to do is pass the $context['user']['name'] variable instead of $name.

But this means you have to make all that code work in a PHP article or block. You would need to declare $context as global.
global $context;

And then put your html in an echo statement. But from the looks of it, you already have a mix of PHP, I can't really tell.


Thank you for your reply. This is actually the code that comes from the cbox site. It's just boilerplate. The only part that they've added for integration is this "

Quote
&amp;nme=&lt;?=urlencode($name])?&gt;&amp;nmekey=&lt;?=md5('PrivateKey'.$name)?&gt"

They say on their site that this is for general PHP forums/website and to just add that code in where I placed it above, then change the $name to what's needed to pull the username. Unfortunately I'm not a programmer of any sort and it's all greek to me.

I did try putting this into a PHP block and got an error (don't remember what it was at the moment). I did suspect there was a mix. Just don't know how to fix. Suggestions beyond what you said would be welcome, in the meantime I guess I need to do some tweaking and see if I can figure it out.

Thanks again.

nikljones

Cbox graciously wrote the code I needed to integrate cbox into a TP PHP block. Below is the code.



global $context;
echo '<script type="text/javascript">
function popcbox() {
  cboxwin = window.open("","Cbox","width=300,height=400,toolbar=no,scrollbars=no,status=no,resizable=yes");
  cboxwin.document.write(\'<html><head><title>Cbox</title></head><frameset rows="*,75" frameborder="0" framespacing="0">\');
  cboxwin.document.write(\'<frame marginwidth="2" marginheight="2" src="http://www7.cbox.ws/box/?boxid=845&boxtag=wwacy1&sec=main" noresize="true" scrolling="auto" name="cboxmain" style="border:#ababab 1px solid;"/>\');
cboxwin.document.write(\'<frame marginwidth="2" marginheight="2" src="http://www7.cbox.ws/box/?boxid=845&boxtag=wwacy1&sec=form&nme='.urlencode($context['user']['name']).'&nmekey='.md5('privatekey'.$context['user']['name']).'" noresize="true" scrolling="no" name="cboxform" style="border:#ababab 1px solid;border-top:0px"/></frameset>\');  cboxwin.document.write(\'<noframes>Cbox needs frames!</noframes></html>\');
  try {
    x = screen.width;
    y = screen.height;
    cboxwin.moveTo(Math.max((x/2)-150, 0), Math.max((y/3)-200));
  } catch (e) {};
}
</script>
<a href="JavaScript:popcbox();">Pop up my Cbox</a>';



Be certain to put your private key where PrivateKey is in the code.

I put this in a PHP block.

Nick

This website is proudly hosted on Crocweb Cloud Website Hosting.