PHP in a plugin
PHP in a plugin
I want to put some PHP and HTML code in a plugin that will fetch the newest images from my coppermine album.
So basically, I want to make a custom plugin.
Will the html nugget work? How bout gutting a pre-existing plugin and replacing it with my own code?
Can someone tell me how to approach this?
So basically, I want to make a custom plugin.
Will the html nugget work? How bout gutting a pre-existing plugin and replacing it with my own code?
Can someone tell me how to approach this?
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: PHP in a plugin
Hi!
The HTML nugget is not for PHP code. You'll need to create your own plugin!
However, there is already a "Media sidebar" plugin that can output plugins from a gallery installation. Checkout serendipity_plugin_imagesidebar (on spartacus), this already has a coppermine_sidebar.php file that you might want to modify.
Regards,
Garvin
The HTML nugget is not for PHP code. You'll need to create your own plugin!
However, there is already a "Media sidebar" plugin that can output plugins from a gallery installation. Checkout serendipity_plugin_imagesidebar (on spartacus), this already has a coppermine_sidebar.php file that you might want to modify.
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/
simple PHP-include (for text-file) - Plugin a must?
Hi!
May I add a related question?!
In this Page: http://www.shopanbieter.de/news/index.php
I would like to 'extract' the code parts of the main menue (top) as well as of the newsletter-box (right) into separate text-files as both are elements of the whole site and should be maintained in a central file (e.g. mainmenue.inc)
So I need to make something like this:
<? include('include/common_navi.php');?>
Only of course, this doesn't work. So do I really need to create plugins for this simple task? Isn't there some smarty-something that does a simple include or so?
Thanks for your hints (I did not really understand the plugin-concept as described here: http://www.s9y.org/78.html#A4, I'm more in HTML and only very very basic PHP, like 'include' ;-((
Nicola
May I add a related question?!
In this Page: http://www.shopanbieter.de/news/index.php
I would like to 'extract' the code parts of the main menue (top) as well as of the newsletter-box (right) into separate text-files as both are elements of the whole site and should be maintained in a central file (e.g. mainmenue.inc)
So I need to make something like this:
<? include('include/common_navi.php');?>
Only of course, this doesn't work. So do I really need to create plugins for this simple task? Isn't there some smarty-something that does a simple include or so?
Thanks for your hints (I did not really understand the plugin-concept as described here: http://www.s9y.org/78.html#A4, I'm more in HTML and only very very basic PHP, like 'include' ;-((
Nicola
-
carl_galloway
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: simple PHP-include (for text-file) - Plugin a must?
Hi!
Check the "include_php" command from smarty. First you need to disable smarty security in your template's config.inc.php file:
to be able to use that inside your .tpl files.
Regards,
Garvin
Check the "include_php" command from smarty. First you need to disable smarty security in your template's config.inc.php file:
Code: Select all
<?php
$serendipity['smarty']->security = false;
?>
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/
Re: simple PHP-include (for text-file) - Plugin a must?
Hi to both of you!
because I fear, that this means that ma project then be somehow
'insecure'... Is it?
Greetings
Nicola
I read about that at the mentioned page. And dismissed this optiongarvinhicking wrote:Hi!
Check the "include_php" command from smarty. First you need to disable smarty security in your template's config.inc.php file:
because I fear, that this means that ma project then be somehow
'insecure'... Is it?
Greetings
Nicola
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: simple PHP-include (for text-file) - Plugin a must?
Hi!
Well, it's the only way. If you want to include a foreign piece of code (which your header/footer is), you can only do it that way, or not include it at all.
Regards,
Garvin
Well, it's the only way. If you want to include a foreign piece of code (which your header/footer is), you can only do it that way, or not include it at all.
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/
Re: simple PHP-include (for text-file) - Plugin a must?
Hi!
NOT in _my_ Template-Folder (nor in one of the others like "default",
as I can see). Nor can I find it somewhere else. Not a
"config.inc.php", nor a
"config.inc.php.file" (as written on http://www.s9y.org/78.html#A4,
but that's a mistake, is it? Just wanted to be sure about the name...)
Should I create such a file? Inside my Template-Folder and/or
any template folders, I've have (I use an nother template-style
for one special cathegory)?
TIA
Nicola
Seems, I'm to dumb or to blind ;-( Where do I find this file? It'sgarvinhicking wrote: in your template's config.inc.php file:
NOT in _my_ Template-Folder (nor in one of the others like "default",
as I can see). Nor can I find it somewhere else. Not a
"config.inc.php", nor a
"config.inc.php.file" (as written on http://www.s9y.org/78.html#A4,
but that's a mistake, is it? Just wanted to be sure about the name...)
Should I create such a file? Inside my Template-Folder and/or
any template folders, I've have (I use an nother template-style
for one special cathegory)?
TIA
Nicola
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: simple PHP-include (for text-file) - Plugin a must?
Hi!
This file might not exist for your template. You can create the file, if it's not there.
Regards,
Garvin
This file might not exist for your template. You can create the file, if it's not there.
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/
Re: simple PHP-include (for text-file) - Plugin a must?
[quote="garvinhicking"]This file might not exist for your template. You can create the file, if it's not there./quote]
Thanks - works very well!
Regards
Nicola
Thanks - works very well!
Regards
Nicola
Re: simple PHP-include (for text-file) - Plugin a must?
Just, that it breaks the RSS-Feed:Nicola wrote: Thanks - works very well!
XML-Verarbeitungsfehler: XML-Deklaration nicht am Beginn von externer Entität
Adresse: http://www.shopanbieter.de/news/feeds/index.rss2
Zeile Nr. 1, Spalte 2: <?xml version="1.0" encoding="utf-8" ?>
-^
http://www.shopanbieter.de/news/feeds/index.rss2
How does the 'insecure-Mode' affect the RSS-Feeds? Can I have
my includes AND a proper RSS-Feed?
As we _need_ the RSS-Feeds, I will have to return to old
Version very soon, so if You want to have a look, please
hurry ;-(
Greetings
Nicola
Re: simple PHP-include (for text-file) - Plugin a must?
Hi!
Ok, what it does is this:
RSS-File 'normal' (=secure mode):
-----------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
-----------------------------------------------
RSS File with "insecure-mode":
-----------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
-----------------------------------------------
You see: It's a space that causes the problems...
Any idea, where this space comes from?
And - more important, how we get rid of it?
Thanks
Nicola
Ok, what it does is this:
RSS-File 'normal' (=secure mode):
-----------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
-----------------------------------------------
RSS File with "insecure-mode":
-----------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
-----------------------------------------------
You see: It's a space that causes the problems...
Any idea, where this space comes from?
And - more important, how we get rid of it?
Thanks
Nicola
Re: simple PHP-include (for text-file) - Plugin a must?
Mist. You don't see the space ;-(
Believe me, it's here:
RSS File with "insecure-mode":
-----------------------------------------------
_<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
-----------------------------------------------
Believe me, it's here:
RSS File with "insecure-mode":
-----------------------------------------------
_<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
-----------------------------------------------
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: simple PHP-include (for text-file) - Plugin a must?
Hi!
Make sure you don't have any spaces in your config.inc.php file - it comes from there.
regards,
Garvin
Make sure you don't have any spaces in your config.inc.php file - it comes from there.
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/
Re: simple PHP-include (for text-file) - Plugin a must?
true, there it was. *SIGH*garvinhicking wrote:Make sure you don't have any spaces in your config.inc.php file - it comes from there.
THANKS!
Nicola