Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-07-06 08:58:27
- elwario91
- Member
- Registered: 2007-07-06
- Posts: 42
...use PHP code?
Hi!
I like textpattern but I would like to know if it’s possible to write an article with php in it?
Adding php scripts would be fine because otherwise I will have to use a static file and the menu will also be static :S
Thanks in advance!
Offline
Re: ...use PHP code?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#3 2007-07-06 09:19:17
- elwario91
- Member
- Registered: 2007-07-06
- Posts: 42
Re: ...use PHP code?
This is what I’ve entered in the body of an article:
[code]
.notextile <txp:php>
<?php
/* My PHP code */
?>
[/code]
Also tried with removing <?php and ?> but still doesn’t work!
This is the error:
Parse error: parse error, unexpected ‘<’ in /var/www/users/regnumfr/textpattern/publish/taghandlers.php(2688) : eval()’d code on line 1
Help me! :)
Last edited by elwario91 (2007-07-06 09:19:28)
Offline
Re: ...use PHP code?
what you need is
.notextile <txp:php>
/* My PHP code */
</txp:php>
without the normal opening and closing php tags
Last edited by colak (2007-07-06 09:44:19)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#5 2007-07-06 11:33:02
- elwario91
- Member
- Registered: 2007-07-06
- Posts: 42
Re: ...use PHP code?
This is the content of my article:
.notextile <txp:php>
/* Fonction */
function verifier_courriel($courriel) {
$syntaxe=’#^[\w.]+@[\w.]+\.[a-zA-Z]{2,5}$#’;
if(preg_match($syntaxe,$courriel))
return true;
else
return false;
}
/* /Fonction */
/* Formulaire */
if(isset($_POST[‘inscription’]))
{
$nom = $_POST[‘nom’];
$prenom = $_POST[‘prenom’];
$pseudo = $_POST[‘pseudo’];
$mdp = $_POST[‘mdp’];
$courriel = $_POST[‘courriel’];
if(empty($nom) OR empty($prenom) OR empty($pseudo) OR empty($mdp) OR empty($courriel))
{
echo “Tous les champs ne sont pas remplis!”;
}
else
{
$l_mdp = strlen($mdp);
if($l_mdp >= “6”)
{
if(verifier_courriel($courriel)) { echo “L’adresse courriel est invalide!”; }
else
{
/* Tout peut être envoyé! */
$destinataire = “regnumfr@titi-serveur.net”;
$sujet = “[Regnum Fr] Validation rédacteur”;
$candidat = $courriel;
$message = “Pseudo: $pseudo\nNom: $nom\nPrénom: $prenom\nMot de passe: $mdp\nCourriel: $courriel”;
$mail = mail($destinataire,$sujet,$sessage,$candidat);
if($mail)
{
echo “Le compte sera validé le plus vite possible, un mail de confirmation sera envoyé une fois le compte crée!”;
}
else
{
echo “Un problème est survenu, veuillez envoyer un mail à regnumfr_AT_titi-serveur_DOT_net!”;
}
/* Fin du script principal :) */
}
}
else
{
echo “Le mot de passe doit au minimum être composé de 6 lettres ou chiffres!”;
}
}
}
else
{
?>
<form action=“inscription.php” method=“post”>
Nom: <input type=“text” name=“nom”><br />
Prénom: <input type=“text” name=“prenom”><br />
Pseudo: <input type=“text” name=“pseudo”><br />
Mot de passe: <input type=“text” name=“mdp”><br />
Courriel: <input type=“text” name=“courriel”><br /><br />
<input type=“submit” name=“inscription” value=“S’inscrire!”>
</form>
<?php
}
/* /Formulaire */
</txp:php>
And here’s the error on the page:
.notextile
Parse error: parse error, unexpected ‘<’ in /var/www/users/regnumfr/textpattern/publish/taghandlers.php(2688) : eval()’d code on line 1
Rédigé par Warren Dumortier
I don’t understeand why it doesn’t work…
Last edited by elwario91 (2007-07-06 11:33:22)
Offline
Re: ...use PHP code?
I’m not a programmer but I see a php opening tag there…
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: ...use PHP code?
You cannot use <php ... ?>
inside <txp:php></txp:php> tags
Offline
#8 2007-07-06 17:37:52
- elwario91
- Member
- Registered: 2007-07-06
- Posts: 42
Re: ...use PHP code?
If i add this tiny content:
.notextile <txp:php>
/* My PHP code */
</txp:php>
I have the same error!
Offline
#9 2007-07-06 17:53:17
- elwario91
- Member
- Registered: 2007-07-06
- Posts: 42
Re: ...use PHP code?
Is it possible to create forms in an article?
The error was that there can’t be a blank line between <txp:php> and </txp:php>
But when trying to echo ‘’ a form it doesn’t work :S
Otherwise is there a simple way to have a page where someone can subscribe for creating pages without having the administrator to create an account.
Last edited by elwario91 (2007-07-06 17:57:01)
Offline
#10 2007-07-06 21:02:22
- elwario91
- Member
- Registered: 2007-07-06
- Posts: 42
Re: ...use PHP code?
I made a manual subscription process but I would like to solve it.
I’ve found some plugins but I couldn’t let them work, they were installed but the tags didn’t work…
Offline
Re: ...use PHP code?
What happens if you do this (with an empty space at the beginning of each line):
<txp:php>
/* just a comment */
</txp:php>
PS. have you checked your preferences to make sure that you allow the use of PHP inside articles?
Last edited by ruud (2007-07-06 21:41:00)
Offline
#12 2007-07-07 07:12:27
- elwario91
- Member
- Registered: 2007-07-06
- Posts: 42
Re: ...use PHP code?
Yes, it’s allowed and in frecnh I’ve also activated “Code PHP Brute”.
Sorry, don’t know the translation!
Offline
Pages: 1