Jump to content

Archived

This topic is now archived and is closed to further replies.

g-sal

Can you take in HTML mark up as a value?

Recommended Posts

Hi,

 

I've created this object where a programmer can set all these values and the object can print out a div box with all the values formatted. In this div box I'd like to have this free text area that could potentially include images and tables and all sorts of HTML markup.

 

Here's an example of how the code would look like:

 

<?php

$event = new Event();

$event->title = "My title";

$event->description = "<p>My description</p>";

$event->display();

?>

 

Since I'm using Dreamweaver, I'd like the description to be defined outside the php tags so I can make full use of Dreamweavers GUI. The thing is, I don't know if PHP has a syntax that will enable me to do something like this:

 

<?php

$event = new Event();

$event->title = "My title";

$event->description = {

?>

<img src="..." /><p>description</p>

<?php }

$event->display();

//etc...

?>

 

Does anyone know is something similar is possible?

 

Thanks!

Share this post


Link to post
Share on other sites
Hi,

 

I've created this object where a programmer can set all these values and the object can print out a div box with all the values formatted.  In this div box I'd like to have this free text area that could potentially include images and tables and all sorts of HTML markup.

 

Here's an example of how the code would look like:

 

<?php

$event = new Event();

$event->title = "My title";

$event->description = "<p>My description</p>";

$event->display();

?>

 

Since I'm using Dreamweaver, I'd like the description to be defined outside the php tags so I can make full use of Dreamweavers GUI.  The thing is, I don't know if PHP has a syntax that will enable me to do something like this:

 

<?php

$event = new Event();

$event->title = "My title";

$event->description = {

?>

<img src="..." /><p>description</p>

<?php }

$event->display();

  //etc... 

?>

 

Does anyone know is something similar is possible?

 

Thanks!

269857[/snapback]

 

 

what you are saying should work if im not mistaken, i use similar methods but not with ->, give it a go

Share this post


Link to post
Share on other sites

Doing:

 

$event->description = { ?> ....... <? }

 

doesn't work.

 

 

Share this post


Link to post
Share on other sites

and will never work. you cant half assign a value to a variable, jump out of php to do something else then come back to php and expect it to be waiting. besides, what are the curly braces there for? your syntax is whack.

Share this post


Link to post
Share on other sites
and will never work. you cant half assign a value to a variable, jump out of php to do something else then come back to php and expect it to be waiting. besides, what are the curly braces there for? your syntax is whack.

271195[/snapback]

 

Ok that's what I wanted to know, whether something similar is possible, not whether my syntax is right because i know it's wrong.

 

When it comes to functions or conditional statements you can jump into HTML. For example:

 

<? if ($var = $something) ?>

<p>Do this</p>

<? } else { ?>

<p>Do something else</p>

<? } ?>

 

I wanna know if I can store that html in a variable. I like to develop my HTML in Dreamweaver, have Dreamweaver preview the HTML in it's internal browser. That's why I want to know if this is possible.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.