Jump to content

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!

Link to comment
https://forums.phpfreaks.com/topic/2458-can-you-take-in-html-mark-up-as-a-value/
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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.