Re: echo within a echo

2008-01-30 Thread JP

eval should work, too, just use ?> to leave php mode for plain html
output.
So if you have html and php, use this:
---
$code =
'?>checkbox("User/news"); ?> (Tick for yes)';

eval($code);
---

Note the initial ?> to quit the initial php block which eval assumes.
However, as United mentioned, be careful to provide this functionality
for obvious security reasons.

Best,
JP



On 30 Jan., 08:10, Unite <[EMAIL PROTECTED]> wrote:
> Hey, was wondering if anyone can help me.
> I have code from a database that uses mixed PHP and HTML. When I try
> to output it (echo) it doesnt display the page correctly as theres a
> echo within the DB code.
>
> Example
> Saved in DB :
> 
> >checkbox("User/news"); ?> (Tick for yes)
>
> Output on screen:
> Recieve Specials and Discount Alerts :  checkbox("User/news"); ?>
> (Tick for yes)
>
> Saved on webpage:
>  //saved in Hex in the DB
>
> So basically I want it to display the check box instead of
> checkbox("User/news"); ?>
>
> Any help much appreciated
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: echo within a echo

2008-01-30 Thread grigri

The easiest way would be to write the content to a temp file, then
render that temp file as an element.

This would be slow if done on every request, so some cacheing
mechanism is a must.

Beware of security implications though. This will effectively allow
people to execute arbitrary php on your webserver, and sanitizing PHP
code is not as easy as it sounds. Make absolutely sure you need this
level of customization before you allow it.

On Jan 30, 9:20 am, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Wow.. i got stuck in a similar problem some time back, but after certain
> thoughts i shifted on to the html/plain php format only because i never
> thought that my administrators would be equipped with cake terminology, but
> ur Q has set me thinking again...
>
> Thanks.
>
> On 1/30/08, Unite <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Well here is what im trying to do. I have set up a layout in cakephp
> > that will be global. I have a admin section where people can update
> > the contents of the "$content_for_layout" (not really but a  > table> contents within $content_for_layout) by using a text area to
> > hard input html/php code into the database. So in a nut shell. The
> > user inputs there html/php into a textbox in the admin section which
> > then gets saved to the DB. When the specific page is loaded it looks
> > in the DB for the code that was input in admin and displays it.
> > I can do this by using html tags for "inputs" but want to keep to the
> > cake format of echo $html->input("").
> > I have seen the mention of using eval() but that only evaluates php.
> > Hopefully the problem is better understood now.
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: echo within a echo

2008-01-30 Thread Novice Programmer
Wow.. i got stuck in a similar problem some time back, but after certain
thoughts i shifted on to the html/plain php format only because i never
thought that my administrators would be equipped with cake terminology, but
ur Q has set me thinking again...

Thanks.


On 1/30/08, Unite <[EMAIL PROTECTED]> wrote:
>
>
> Well here is what im trying to do. I have set up a layout in cakephp
> that will be global. I have a admin section where people can update
> the contents of the "$content_for_layout" (not really but a  table> contents within $content_for_layout) by using a text area to
> hard input html/php code into the database. So in a nut shell. The
> user inputs there html/php into a textbox in the admin section which
> then gets saved to the DB. When the specific page is loaded it looks
> in the DB for the code that was input in admin and displays it.
> I can do this by using html tags for "inputs" but want to keep to the
> cake format of echo $html->input("").
> I have seen the mention of using eval() but that only evaluates php.
> Hopefully the problem is better understood now.
>
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: echo within a echo

2008-01-30 Thread Unite

Well here is what im trying to do. I have set up a layout in cakephp
that will be global. I have a admin section where people can update
the contents of the "$content_for_layout" (not really but a  contents within $content_for_layout) by using a text area to
hard input html/php code into the database. So in a nut shell. The
user inputs there html/php into a textbox in the admin section which
then gets saved to the DB. When the specific page is loaded it looks
in the DB for the code that was input in admin and displays it.
I can do this by using html tags for "inputs" but want to keep to the
cake format of echo $html->input("").
I have seen the mention of using eval() but that only evaluates php.
Hopefully the problem is better understood now.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: echo within a echo

2008-01-30 Thread Novice Programmer
I am confused on why did you store the html source to generate check box in
the db. I think you want it the way JP wrote the code (i.e story the
response of the check box). Isn't it?

Thanks.


On 1/30/08, JP <[EMAIL PROTECTED]> wrote:
>
>
> Try to store the return value of the $html->checkbox call:
>
> $checkboxOutput = $html->checkbox("User/news");
> $saveToDB = ''.
> $checkboxOutput.' (Tick for yes)';
>
> Then save the value of $saveToDB to the database.
>
> jp
>
> On 30 Jan., 08:10, Unite <[EMAIL PROTECTED]> wrote:
> > Hey, was wondering if anyone can help me.
> > I have code from a database that uses mixed PHP and HTML. When I try
> > to output it (echo) it doesnt display the page correctly as theres a
> > echo within the DB code.
> >
> > Example
> > Saved in DB :
> >  >
> > >checkbox("User/news"); ?> (Tick for yes)
> >
> > Output on screen:
> > Recieve Specials and Discount Alerts :  checkbox("User/news");
> ?>
> > (Tick for yes)
> >
> > Saved on webpage:
> >  //saved in Hex in the DB
> >
> > So basically I want it to display the check box instead of
> > checkbox("User/news"); ?>
> >
> > Any help much appreciated
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: echo within a echo

2008-01-29 Thread JP

Try to store the return value of the $html->checkbox call:

$checkboxOutput = $html->checkbox("User/news");
$saveToDB = ''.
$checkboxOutput.' (Tick for yes)';

Then save the value of $saveToDB to the database.

jp

On 30 Jan., 08:10, Unite <[EMAIL PROTECTED]> wrote:
> Hey, was wondering if anyone can help me.
> I have code from a database that uses mixed PHP and HTML. When I try
> to output it (echo) it doesnt display the page correctly as theres a
> echo within the DB code.
>
> Example
> Saved in DB :
> 
> >checkbox("User/news"); ?> (Tick for yes)
>
> Output on screen:
> Recieve Specials and Discount Alerts :  checkbox("User/news"); ?>
> (Tick for yes)
>
> Saved on webpage:
>  //saved in Hex in the DB
>
> So basically I want it to display the check box instead of
> checkbox("User/news"); ?>
>
> Any help much appreciated
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



echo within a echo

2008-01-29 Thread Unite

Hey, was wondering if anyone can help me.
I have code from a database that uses mixed PHP and HTML. When I try
to output it (echo) it doesnt display the page correctly as theres a
echo within the DB code.

Example
Saved in DB :
checkbox("User/news"); ?> (Tick for yes)

Output on screen:
Recieve Specials and Discount Alerts :  checkbox("User/news"); ?>
(Tick for yes)

Saved on webpage:
 //saved in Hex in the DB

So basically I want it to display the check box instead of
checkbox("User/news"); ?>

Any help much appreciated
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---