Calling external php files on sidebar [help!]

Get help with installation and running PivotX 2.0.x here. Please do not post Extension or Theme related questions here.

Calling external php files on sidebar [help!]

Postby TortillaBoy » Sat Apr 14, 2012 2:34 pm

Hi,

I just started yesterday testing pivotx as an alternative to wp to use on databaseless hosting.

And I'm having a little trouble here, is it possible to use php include or $homepage = file_get_contents in order to call external .php files?

I'm using it with wp to make it easy and quick to edit blogroll links from my blogs and I wonder if I can use the same method with pivotx blogs.

I use this:

<?php
$homepage = file_get_contents('http://mydomain.com/links.php');
echo $homepage;
?>


Or in alternative:

<?php include('http://mydomain.com/links.php'); ?>


I just tried both editing Page>links and editing _sub_sidebar.html without any success ...
TortillaBoy
 
Posts: 3
Joined: Sat Apr 14, 2012 2:15 pm

Re: Calling external php files on sidebar [help!]

Postby Schop » Sat Apr 14, 2012 5:56 pm

First make sure you set 'allow_php_in_templates' to '1' in advanced configuration (you may have to add the key).

Then, instead of the tags '<?php' and '?>' use the smarty tages [[php]] and [[/php]] around your code.
User avatar
Schop
Contributor
 
Posts: 481
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio

Re: Calling external php files on sidebar [help!]

Postby TortillaBoy » Sun Apr 15, 2012 3:15 pm

Thanks for the tip!

I't works fine as an entry but I can't figure out how to make it to the sidebar, I can't find a way to do it with a .php file or a simple vertical banner inside the sidebar, do I have to edit the template or there's any other way?
TortillaBoy
 
Posts: 3
Joined: Sat Apr 14, 2012 2:15 pm

Re: Calling external php files on sidebar [help!]

Postby Harm10 » Mon Apr 16, 2012 9:08 am

I think you have to edit the template. But perhaps you can add a [[getpage]] or [[getentry]] there (see documentation http://book.pivotx.net/index.php?page=app-b and display its content ($page.introduction and so on) and put you changing php code in the page (or entry) you are pointing to? Also notice the [[include]] template tag.
Quality is in the detail of things............
Harm10
Developer
 
Posts: 1607
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Calling external php files on sidebar [help!]

Postby Schop » Mon Apr 16, 2012 1:13 pm

TortillaBoy wrote:Thanks for the tip!

I't works fine as an entry but I can't figure out how to make it to the sidebar, I can't find a way to do it with a .php file or a simple vertical banner inside the sidebar, do I have to edit the template or there's any other way?


Well yes, to display something on any page you'd have to edit the templates. the file you have to edit may vary with which theme you use and which position on the screen you want to put your code.

Thinking of this, it might actually be easier to write an extension for what you want to do, and then just use the [[ myextension ]] Smarty tag in your templates (assuming your extension is called 'myextension').
User avatar
Schop
Contributor
 
Posts: 481
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio

Re: Calling external php files on sidebar [help!]

Postby TortillaBoy » Mon Apr 16, 2012 10:26 pm

Once again thanks for the help.

Actually I'm doing it editing the template and it is working just fine! ;)
TortillaBoy
 
Posts: 3
Joined: Sat Apr 14, 2012 2:15 pm


Return to 2.x Support Forum

Who is online

Users browsing this forum: No registered users and 2 guests

cron