Editbox and echo statement

This section is for posting questions which are not directly related to WYSIWYG Web Builder.
Examples of off topics: web server configuration, hosting, programming related questions, third party scripts.

Note that these questions will generally not be answered by the administrators of this forum.
Post Reply
hjones43
 
 
Posts: 20
Joined: Wed Aug 23, 2017 9:37 pm

Editbox and echo statement

Post by hjones43 » Fri May 07, 2021 6:46 pm

I use PHP frequently in WWB projects. I would like to be able to control formatting (font size, color) when using the echo statement within an editbox.

The statement below used within a PHP script obediently writes it to the top line on my page with proper formatting.

echo "<p> <font color=blue font face='arial' size='12pt'>($_SESSION["DocumentTitle"]) </p>";

However, when I embed it within an editbox inside a form using the statement below

<?php echo( "<p> <font color=blue font face='arial' size='12pt'>($_SESSION["DocumentTitle"]) </p>" ); ?>

The following shows up in the editbox when I run the project

<p> <font color=blue font face='arial' size='12pt'>One line simple string in blue color, arial font and font size 12pt</font> </p>

I have successfully used <?php echo("Hello World"); ?> type statements (no formatting) in editboxes before.

Can anyone unravel this mystery for me?

Much appreciated.

Harry Jones

User avatar
crispy68
 
 
Posts: 1501
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: Editbox and echo statement

Post by crispy68 » Fri May 07, 2021 7:12 pm

I'm not php expert, but I believe the normal css would be as such:

<p style='color:blue;font-family:arial;font-size:12pt;'>your text here</p>

or possibly just add a class and then add the class to your .css file.

<p class='demo'>your text here</p>

and then in a html box/page html add to the <head> section:

<style>
.demo{color:blue;font-family:arial;font-size:12pt;}
</style>

Using <font> is deprecated in html5.

MGD4me
 
 
Posts: 239
Joined: Tue May 02, 2017 11:56 pm
Location: BC, Canada

Re: Editbox and echo statement

Post by MGD4me » Fri May 07, 2021 10:33 pm

Try something like: (I haven't tried it)

echo "<p>< font color=blue font face='arial' size='12pt'> $_SESSION['DocumentTitle']</p>";
Last edited by MGD4me on Thu May 20, 2021 5:30 pm, edited 2 times in total.

lummis
 
 
Posts: 214
Joined: Sun Apr 24, 2011 9:18 am
Location: UK

Re: Editbox and echo statement

Post by lummis » Sat May 08, 2021 12:01 pm

Am I missing something? The Editbox properties have a Style tab where you can define the font size and colour. Doesn't that work?

Brian

Edit - I should have added that you can place the php echo statement as the initial value.

hjones43
 
 
Posts: 20
Joined: Wed Aug 23, 2017 9:37 pm

Re: Editbox and echo statement

Post by hjones43 » Mon May 10, 2021 9:41 pm

Thanks everyone for your help. I'm an idiot. I thought I had tested Brian's suggestion and it didn't work properly but that is not the case.

Best,
Harry Jones

Post Reply