{php}{/php} tags don't work

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
3sq
New Member
New Member
Posts: 4
Joined: Wed Mar 02, 2011 9:25 am

{php}{/php} tags don't work

Post by 3sq »

Hello,

I've created an website using cmsms(v 1.9.4.1.) with quattro simple theme.

Managed to do everything ok whille developing it as a subdomain. Now I've done everything from the start on the actual hosting package.

The problem is that even if I've just copied the code from the previous site I'm not getting any response from the code in the pages.

I have to mention that I've disabled WYSIWYG editor to be sure that the code don't get altered and also edited config file and activated smarty tags.

Do you have any idea why the website is showing the code instead of running the scripts?

Is there any change that had been made in the way you deal with php code inside cmsms since the 1.9.3 version on which I firstly developed the website?

EXAMPLE:

this code:
---------------------------------------------------------------
{php}

session_start();


$data = mysql_query("SELECT * FROM evenimenteEMC");
$n=1;

echo "<table border=\"0\" >";


while($result = mysql_fetch_array( $data ))
{
echo "<tr><td rowspan=\"3\">";
$tip=$result['tip_eveniment'];
$value=$result['id'];


if($tip=="curs online"){

{/php}
<form action="index.php?page=descriere-eveniment" method="post" name={php} echo $result['id'] ; {/php}>

<input type="hidden" name="detalii" id="detalii" value= {php} echo $result['id'] ; {/php} >

<input type="image" src="uploads/images/p1.jpg" value="submit" ></td>

</form>
{php} etc.
---------------------------------------------------------------

returns this:
..................................................................
session_start(); $data = mysql_query("SELECT * FROM evenimenteEMC"); $n=1; echo ""; while($result = mysql_fetch_array( $data )) else if($tip=="simpozion")else if($tip=="congres")else if($tip=="curs rezidential")else if($tip=="conferinta")else if($tip=="expozitie")else if($tip=="workshop") echo ""; echo ""; echo ""; echo ""; echo ""; $n++;} echo "
"; echo ""; echo $result['nume_curs']; echo ""; echo " / "; echo $result['data_inceput']; echo "
"; echo $result['localitate']; echo " / credite:"; echo $result['nr_credite']; echo $result['acreditare']; echo "
"; echo $result['tel']; echo " / "; echo $result['web']; echo "
" ;
..................................................................

please let me know if you have any suggestions.

Regards,
Razvan
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm
Location: the Netherlands

Re: {php}{/php} tags don't work

Post by M@rtijn »

There is no {php} tag in CMSMS, tags from different systems are not interchangable.

You can copy your php code into a UDT (user defined tag) without {php} of ?php, then call the udt in your page using {udt_name}
(where udt_name is the exact name you specified for the udt)
Make your community a better place!
3sq
New Member
New Member
Posts: 4
Joined: Wed Mar 02, 2011 9:25 am

Re: {php}{/php} tags don't work

Post by 3sq »

Ok, please tell me more about hou I should use the UDT.

I understood that I don't have to use {php} but since my code uses php code alternated with simple html forms can I use normal <php> tags? Or should I do udt's for every line of php code I use in the script?

P.S.:

And I assure you that tags {php}{/php} worked in the previous version of cmsms I've used.

here is from http://wiki.cmsmadesimple.org/index.php/Developers_FAQ :
A2: Using {php} and {/php} Tags

The second way to include php code into your page is by using {php} and {/php} tags to surround your php code in your page or template (you do not need the <?php and ?> tags with this syntax). However, this functionality is disabled by default on new installs.
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: {php}{/php} tags don't work

Post by spcherub »

As M@rtijn mentioned, the proper way to use custom code is using the UDT.

To create a UDT, go to Extensions > User Defined Tags, then click "+ Add User Defined Tag". Give your new tag a name (example: my_tag), paste your PHP code into the "Code" textarea and save. Remember, don't put any <php> or {php} tags into the code.

Next in your page or template, you can call your custom UDT by simply inserting the name of the UDT you saved in the above step - example {my_tag}.

Regarding being able to use {php} tags, you will need to enable this in the config.php file for this to work. This is supported by not recommended.

Hope that helps.

-S
3sq
New Member
New Member
Posts: 4
Joined: Wed Mar 02, 2011 9:25 am

Re: {php}{/php} tags don't work

Post by 3sq »

It helped! Thanks to both of you! I've managed to do the job using UDT's but it still feels strange when something stoped working and I can't get the cause.

p.s. As I mentioned I've edited the config file.

Thank you again!
Razvan.
Post Reply

Return to “The Lounge”