Pass PHP code to page from record

6 posts by 2 authors in: Forums > CMS Builder
Last Post: May 29, 2014   (RSS)

By nmsinc - May 26, 2014

I want to store some PHP code within a record then pass it through to a page. How can this be done without it parsing as HTML?

Thanks - nmsinc

nmsinc

By Damon - May 26, 2014

Hi,

You may be able to include the code already in the target page and then pass in variables and a trigger for the code through the URL.

Can you give me some more details of what you are trying to do and code you want to pass?

Thanks!

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By nmsinc - May 26, 2014

Hi Damon,

I want to allow users to customize their listing grid. The code below will be triggered to replace the current static code when the user has set the record to do so!

Thanks - nmsinc


<td align="center" bgcolor="<?php echo $bgColor ?>">
<?php if ($record['acknowledgment'] == "Accepted"): ?>
<img border="0" alt="" height="25" src="../images/yes.png" width="25" /></a>
<?php elseif ($record['acknowledgment'] == "Rejected"): ?>
<img border="0" alt="" height="25" src="../images/no.png" width="25" /></a>
<?php else: ?>
<img border="0" alt="" height="25" src="../images/warning.png" width="25" /></a>    
<?php endif; ?>
</td>

nmsinc

By nmsinc - May 27, 2014

Hi Damon,

I have a static listing grid on a page that contains data from across a record such as:

Category 1  |  Category 2  |  Category 3  |  Category 4

I want to allow the user to customize the listing grid so that he/she can change it such as

Category 4  |  Category 3  |  Category 2  |  Category 1

If the user sets a $custom record to TRUE then the static grid code would be replaced by the $CUSTOME_GRID code which I listed in the previous post!

The problem is that when I post the $CUSTOM_GRID in place of the static code, even though it contains PHP it posts as HTML code!

Thanks - nmsinc

nmsinc

By Damon - May 29, 2014

Hi,

So it looks like the users will be able to change the sort order of the Categories?

Would passing a URL like this for a set of prefined sort options work?
http://example.com/page.php?sort=numeric
http://example.com/page.php?sort=numeric_reverse
http://example.com/page.php?sort=other

Then in the page.php file you could have code that matches the sort variable (from the URL) and then passes that into the sort order for that page.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/