• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

PHP in sidebar?

Wuebit

Well-known member
#1
Hey i have some php code i need to add to the sidebar

So my question is how can i add php to a template and make it work
I was planing on following this

Thank's
 
F

Floris

Guest
#2
You put the .php in your php file within the framework, populate it to a variable or point it to custom template, and include either the variable or the custom template in the sidebar.

The screenshot is just an untested quick dirty draft to give the impression of what possibly needs to be done. Depending on what YOU need from you plugin, this might be of help to get started.
 

Attachments

Wuebit

Well-known member
#3
You put the .php in your php file within the framework, populate it to a variable or point it to custom template, and include either the variable or the custom template in the sidebar.
Thank's Floris sadly my php skill's are bad ;/ fancy giving me an example <3
Cheer's
 

Wuebit

Well-known member
#5
Eh, there are add-ons you can use as example perhaps. I am a horrible coder myself.
I've attached files to my post now.
Oh i mean the way you called it from the php file (in the template)
Or would i have to mod my php file to work?

Cheer's
 
F

Floris

Guest
#6
{$yourSidebar} in page_container before </sidebar> or </xen:sidebar> (dont recall by memory which one it is)
 

Wuebit

Well-known member
#7
{$yourSidebar} in page_container before </sidebar> or </xen:sidebar> (dont recall by memory which one it is)
Hmm ok am lost lol
so template is this

Code:
<div class="section">
    <div class="secondaryContent">
<h3>Test</h3>
{$images_booru}
    </div>
</div>
adding this before <xen:include template="test" /> will show what's in my php file in the side bar?

It's the {$images_booru} part i don't understand

 
F

Floris

Guest
#8
You're not getting it, but it's complex to just explain in 1 phrase. I recommend to use an existing example and compare it against the videos by kier in the have you seen.. and official developer threads... forums.
 

Wuebit

Well-known member
#9
You're not getting it, but it's complex to just explain in 1 phrase. I recommend to use an existing example and compare it against the videos by kier in the have you seen.. and official developer threads... forums.
Yea i have seen the video's you are on about but that's for a custom page

all i am trying to do is add

PHP:
$output = '';
$cdb = new PDO('mysql:dbname=xxxxxxxxxxx;host=localhost', 'xxxxxxxxxxxxx', 'xxxxxxxxxxxxxx');
$res = $cdb->query("SELECT COUNT(*) AS imgtotal FROM images");
$ct = $res->fetch(PDO::FETCH_ASSOC);
for ($x = 0; $x < strlen($ct['imgtotal']); $x++) $output .= ' <img alt="' . $ct['imgtotal'][$x] . '" src=" /imageboard/ext/home/counters/default/' . $ct['imgtotal'][$x] . '.gif" width="40" height="80"/>';
return $output;
this into a sidebar ;/ oh well thank's anyway Floris
 

Brett Peters

Well-known member
#11
Use widget framework add-on, put the php code into a .php file, then in widget framework html add something like the following

Code:
<center>
<iframe marginwidth="0" marginheight="0" width="40" height="80" scrolling="no" frameborder=0 src="******.php">
</iframe>
</center>
Just a thought
 

Wuebit

Well-known member
#12
Use widget framework add-on, put the php code into a .php file, then in widget framework html add something like the following

Code:
<center>
<iframe marginwidth="0" marginheight="0" width="40" height="80" scrolling="no" frameborder=0 src="******.php">
</iframe>
</center>
Just a thought
Rofl i never thought of an Iframe thank's muchy
 

ProCom

Active member
#13
Use widget framework add-on, put the php code into a .php file, then in widget framework html add something like the following

Code:
<center>
<iframe marginwidth="0" marginheight="0" width="40" height="80" scrolling="no" frameborder=0 src="******.php">
</iframe>
</center>
Just a thought
Just gotta bring this back up to say that it worked PERFECTLY for a big part of our site. We do a weekly favorite picture (pic of the week) and I called our PHP file using iframes just as posted above and it worked in the widget plugin absolutely perfectly!!!