So I'm trying to add some php code to one of my articles so that people can sign up for a news letter. The problem is that serendipity tries to alter the code.
Does anyone know how to work around this problem?
I'm trying to add the follwoing:
<?php
print "<form action='$yourfilepath/sub.php' target ='_blank' method='post'>";
print "<center>E-mail: <input type='text' name='email' size='30'></center><br>";
?>
<?php
print "<center><input type='radio' name='choice' value='sub' checked> Subscribe ";
print "<input type='radio' name='choice' value='unsub'> Unsubscribe</center><br>";
?>
<?php
print "<center><input type='submit' name='submit' value='Subscribe Now!'></center></form>";
?>
adding php to articles
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: adding php to articles
Hi!
PHP is not allowed within entries, please read here:
http://www.s9y.org/78.html#A5
So I advise to get familiar with the plugin API and the Smarty templating. Once you get the hang of it, it is really easy to do. Best look at existing plugins that are somewhat related to what you need to do. Like the 'Send email to friends' plugin or the social bookmarks plugin, they both emit custom HTML/Smarty markup after an entry.
Regards,
Garvin
PHP is not allowed within entries, please read here:
http://www.s9y.org/78.html#A5
Serendipity is centered around plugins, so you should write a plugin that does what you need. It is much cleaner, and mcuh more secure. By having your code in an entry, whenever you modify the code you would need to edit each single entry in which you used it. By having a plugin, you only have one occurence of this to alter.Does anyone know how to work around this problem?
So I advise to get familiar with the plugin API and the Smarty templating. Once you get the hang of it, it is really easy to do. Best look at existing plugins that are somewhat related to what you need to do. Like the 'Send email to friends' plugin or the social bookmarks plugin, they both emit custom HTML/Smarty markup after an entry.
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/
-
Don Chambers
- Regular
- Posts: 3659
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact: