Conditional page
-
Hi.
I basically removed the default sidebar.php code and wrote my own, which resides in /wordpress/wp-content/themes/starkers/sidebar.php
Now, in the sidebar, I have a mailing list form whose ‘action’ file is called mlist.php which resides in /wordpress/mlist.php
i.e. <form action=”/wordpress/mlist.php” method=”post”>…
mlist.php takes the email address address inputted and decides whether or not to add it to a database and then gives appropriate output. But I want this output to blend in with my theme.
So say I create a page:
<?php get_header(); //CONDITIONAL STUFF GOES HERE get_sidebar(); get_footer(); ?>I want mlist.php do the following
if (email address successfully added) { output success message; } else { output error message; }But I want the messages to appear where “//CONDITIONAL STUFF GOES HERE” is above. I tried creating separate php pages and then using header() to redirect but something went wrong. For example, I created the file /wordpress/wp-content/themes/starkers/invalid_email.php and used the following redirect code in mlist.php:
header ("Location: ".TEMPLATEPATH."/invalid_email.php);But this didn’t work and said that http://127.0.0.1/usr/var/www/…/starkers/invalid_email.php didn’t exist. So obviously I don’t understand how wordpress structures these redirects.
Another thing, is that creating a page for each output message seems like overkill for me. Is there a neater way to do what I want?
Sorry for the long post, thanks for reading.
The topic ‘Conditional page’ is closed to new replies.