Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
adding html through php
Old 11-27-2008, 02:59 PM adding html through php
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 312
Name: Jason Eyermann
Location: england bristol
Trades: 0
If I output the $variableexample PHP code below, The divs are outputted as text on the screen.

$variableexample = "<div>" . VARIABLE01 . VARIABLE02 . "</div>";

Is there a way to out put them as HTML?

thanks

Jason
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
 
Register now for full access!
Old 11-27-2008, 03:13 PM Re: adding html through php
Defies a Status

Posts: 1,606
Trades: 0
I an not sure I really understand the example.

To output html via php one uses:

echo "the string to be displayed including tables";

print "the string to be displayed including tables";

both do the same thing.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 11-27-2008, 03:28 PM Re: adding html through php
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 312
Name: Jason Eyermann
Location: england bristol
Trades: 0
This is the actual code I'm using

Code:
 $products_options_display_price= ATTRIBUTES_PRICE_DELIMITER_PREFIX . $products_options->fields['price_prefix'] . $currencies->display_price($new_attributes_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ATTRIBUTES_PRICE_DELIMITER_SUFFIX;
This gets output many times through the site so I want to change it as it is below with the tags.

Code:
 $products_options_display_price= "<div>" . ATTRIBUTES_PRICE_DELIMITER_PREFIX . $products_options->fields['price_prefix'] . $currencies->display_price($new_attributes_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ATTRIBUTES_PRICE_DELIMITER_SUFFIX . "</div>";
Is there a way to do this. I did try ?> <div> <?php but that makes it crash.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
Old 11-27-2008, 05:10 PM Re: adding html through php
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
As in the javascript thread.

You can't put divs inside option elements.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-27-2008, 05:18 PM Re: adding html through php
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 312
Name: Jason Eyermann
Location: england bristol
Trades: 0
yes, of course. I don't know why I said DIV i meant SPAN, or EM. I was just using it as an example. sorry bad example.

sorry to repeat the text above. I'm just trying anyway to do it. It's code within Zen cart.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
Old 11-27-2008, 05:33 PM Re: adding html through php
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Assuming "ATTRIBUTES_PRICE_DELIMITER_PREFIX" is the "(" character, your example should be correct but use single quotes [ ' ] around the string literal rather than double quotes.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-27-2008, 05:52 PM Re: adding html through php
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 312
Name: Jason Eyermann
Location: england bristol
Trades: 0
No that doesn't work. The outputted code in the source is...


<option value="1">test01&lt;em&gt; ( +&pound;50.00 )&lt;/em&gt;</option>

I think this means that something like stripstrings() (or something similar) is being used in the code.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
Old 11-28-2008, 06:06 AM Re: adding html through php
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 312
Name: Jason Eyermann
Location: england bristol
Trades: 0
The code below....

Code:
<?php echo "\n" . $options_menu[$i]; ?>
out-puts the text below this text

Matt Encapsulation ( +&pound;29.90 )

Is there a way to replace the brackets here?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
Old 11-28-2008, 06:48 AM Re: adding html through php
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
PHP Code:
$brackets = array("("")");
$newtext = array("<em>("")</em>"); 
In a global config file


then
PHP Code:
<?php echo "\n" $options_menu[str_replace($brackets $newtext $i)]; ?>
Not tested BTW just "thinking aloud" at the keyboard
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-28-2008, 07:19 AM Re: adding html through php
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 312
Name: Jason Eyermann
Location: england bristol
Trades: 0
Yes! it worked. I had to make a small adjustment to....


<?php echo "\n" . str_replace($brackets , $newtext , $options_menu[$i]); ?>


thanks
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
Old 11-28-2008, 08:45 AM Re: adding html through php
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 312
Name: Jason Eyermann
Location: england bristol
Trades: 0
I've just learnt the hard way that tags eg <em> don't have any effect inside form tags e.g. <option> tags. Is there anyway around this?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
Old 11-28-2008, 12:00 PM Re: adding html through php
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
None probably, you can use a style attribute but it will affect the whole of the text.

Other than that it would be to write your own drop down list and populate a hidden form input with a javascript onclick.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to adding html through php
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37655 seconds with 12 queries