PHP in sidebar?

x4rl

Well-known member
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
 
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

  • Screen shot 2011-02-22 at 3.17.45 AM.webp
    Screen shot 2011-02-22 at 3.17.45 AM.webp
    8.2 KB · Views: 34
  • Screen shot 2011-02-22 at 3.24.22 AM.webp
    Screen shot 2011-02-22 at 3.24.22 AM.webp
    24.7 KB · Views: 31
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
 
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.
 
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
 
{$yourSidebar} in page_container before </sidebar> or </xen:sidebar> (dont recall by memory which one it is)
 
{$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

 
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.
 
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
 
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
 
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
 
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!!!
 
Top Bottom