how to include a random header php script into the index.tpl
how to include a random header php script into the index.tpl
hey guys.
after a bit playing with the different themes I like to include a random header php script into the index.tpl template file.
I tried it with "{include_php}" but there comes errors and errors.
so is here somebody who can give a tip?
thanks for your help.
leo
after a bit playing with the different themes I like to include a random header php script into the index.tpl template file.
I tried it with "{include_php}" but there comes errors and errors.
so is here somebody who can give a tip?
thanks for your help.
leo
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: how to include a random header php script into the index
If you tell us the errors, we might tell you what's wrong.
There are some plugins that take care of random blog descriptions or kubrick headers files. If you're brave, you can also try the suggestions from http://www.s9y.org/index.php?node=78
Regards,
Garvin
There are some plugins that take care of random blog descriptions or kubrick headers files. If you're brave, you can also try the suggestions from http://www.s9y.org/index.php?node=78
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hey guys.
when I trie to include a .php file into the index.tpl with this code:
this error message showes up:
thanks, leo
when I trie to include a .php file into the index.tpl with this code:
Code: Select all
<table id="mainpane">
<tr>
<td>{include_php file="/serendipity_083/plugins/serendipity_event_rotateheader/index.php"}</td>
</tr>
this error message showes up:
So I am a newbie in smarty and php and I hope somebody can give me a tip.Warning: Smarty error: unable to read resource: "" in E:\www\projekte\leo_serendipity_blog\serendipity_083\bundled-libs\Smarty\libs\Smarty.class.php on line 1088
thanks, leo
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
By default the security settings of Smarty do not allow to use the include_php method.
There are two ways to fix this. Both include creating a "config.inc.php" file inside your template directory.
Inside that file you can put:
1. Disable the smarty security settings:
2. Or you can include your functions via that config file:
Inside your template you can then put {$my_content} where you need it.
Regards,
Garvin
There are two ways to fix this. Both include creating a "config.inc.php" file inside your template directory.
Inside that file you can put:
1. Disable the smarty security settings:
Code: Select all
<?php
$serendipity['smarty']->security = false;
$serendipity['smarty']->security_settings = false;
?>
Code: Select all
<?php
ob_start();
include your_php_file.php
$data = ob_get_contents();
ob_end_clean();
$serendipity['smarty']->assign('my_content', $data);
?>
Inside your template you can then put {$my_content} where you need it.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ok, maybe I am too stupid.
I created a config.inc.php file in my template directory (/templates/leo) with this code inside:
then I inserted this code line {$my_content} into my index.tpl file, because I thought that's a variable which includes the link to my php rotateheader script
but nothing happends, no errors and no rotating header....
where's my fault?
thanks leo
I created a config.inc.php file in my template directory (/templates/leo) with this code inside:
Code: Select all
<?php
ob_start();
include('/projekte/leo_serendipity_blog/serendipity_083/plugins/serendipity_event_rotateheader/rotateheader.php');
$data = ob_get_contents();
ob_end_clean();
$serendipity['smarty']->assign('my_content', $data);
?>
but nothing happends, no errors and no rotating header....
where's my fault?
thanks leo
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
First off, the serendipity API logic searches for a "config.inc.php" file.
Second off, $my_content contains the OUTPUT of your inclusion script.
To see if it actually get's executed, change your config.inc.php snippet like this:
Then you should see a "Mein inhalt ist:" string in your template output.
Are you sure that the path /projekte/leo_.../ is the right path? You used an absolute path, usually on webservers you have something like "/www/htdocs/leo/..."...?
Regards,
Garvin
Second off, $my_content contains the OUTPUT of your inclusion script.
To see if it actually get's executed, change your config.inc.php snippet like this:
Code: Select all
<?php
ob_start();
include('/projekte/leo_serendipity_blog/serendipity_083/plugins/serendipity_event_rotateheader/rotateheader.php');
$data = ob_get_contents();
ob_end_clean();
$serendipity['smarty']->assign('my_content', "Mein inhalt ist: $data");
?>
Are you sure that the path /projekte/leo_.../ is the right path? You used an absolute path, usually on webservers you have something like "/www/htdocs/leo/..."...?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Are you sure the path of the include is right?
Create a simple "test.php" script in your s9y root wherer you just put this:
And then check if you get any output?
Regards,
Garvin
Create a simple "test.php" script in your s9y root wherer you just put this:
Code: Select all
<?php
include('/projekte/leo_serendipity_blog/serendipity_083/plugins/serendipity_event_rotateheader/rotateheader.php');
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ok, you are right. I had a mistake in my path.
but now comes another error.
my rotateheader script includes a config_ini file
and I get this mistake now:
thanks leo
but now comes another error.
my rotateheader script includes a config_ini file
Code: Select all
$IMG_CONFIG_FILE = 'images.ini';
so is there something in the serendipity config that disables .ini files?Unable to read ini file.
thanks leo
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
It seems your script tries to read the file frmo the current path, but the current path is Serendipity. You need to try to pass the full path of the ini file to your script.
Regards,
Garvin
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Does it matter
Hi Gavin,
Is there a major risk in turning off the security settings? Is one method better than the other?
If one wants to include multiple functions, do we just repeat the code in the config.inc.php file, or is there a more efficient way?
Thanks Rob
Is there a major risk in turning off the security settings? Is one method better than the other?
If one wants to include multiple functions, do we just repeat the code in the config.inc.php file, or is there a more efficient way?
Thanks Rob
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Does it matter
It's only a major risk, if other people have FTP access to your blog and if you don't want them to mangle with your templates.
It is better to use the config.inc.php setting for security, because you don'T need to patch include/functions_smarty.inc.php that way every time.
You can include multiple functions by just duplicating the call in config.inc.php, yes.
Regards,
Garvin
It is better to use the config.inc.php setting for security, because you don'T need to patch include/functions_smarty.inc.php that way every time.
You can include multiple functions by just duplicating the call in config.inc.php, yes.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/