Site Logo

Office of Web Services Forum

Use this forum for Cascade Support, HTML/CSS tips and tricks, as well as discussions between webmasters from all across the university.
 
It is currently Tue Nov 24, 2009 3:39 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: How to add inline PHP to your pages
PostPosted: Wed Feb 11, 2009 10:50 am 
Offline
Site Admin

Joined: Fri Aug 15, 2008 7:37 am
Posts: 16
Say you want the following code in the content area of your page:
Code:
<?php
echo "this is just a test";

$app->id = 300;

echo $app-id;

for($i=1; $i<=10; $i++){
   echo "$i <br />";
}
?>

However, after you submit, the WYSIWYG converts the code to this:
Code:
<?php
echo "this is just a test";

$app-&gt;id = 300;

echo $app-id;

for($i=1; $i&lt;=10; $i++){
   echo "$i <br />";
}

?>

To prevent this, we will add //<!-- at beginning and // --> at end.
Code:
<?php
// <!--
echo "this is just a test";

$app->id = 300;

echo $app-id;

for($i=1; $i<=10; $i++){
   echo "$i <br />";
}
// -->
?>


This is very similar to the old way of <!--#start-code #end-code--> tags, but the current version of the wysiwyg editor doesnt always support it correctly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group