how to include and execute php variable with html and other php variables in it -


I'm stuck ... I have a variable that contains html (sometimes javascript) and php code (other variables) It's stored in a MySQL and DB. Actually, what I have to do, put the variable in a page -> what works, but the php code is not executed, just like it looks like txt. So I'm exploring a way to insert variables so that php code can be recognized and executed (wars are included) ..

What I have tried so far: (very simple) Sample code is stored in DB:

Image Wise (new_p_img):

  & lt; A href = "product.php" & gt; & Lt; Img src = "new.png" alt = "new product" width = "250" height = "250" & gt; & Lt; / A & gt;  

Image display code Var (new_p_dis):

  & lt; Div class = "new-products" & gt; & Lt ;? Php echo $ new_p_img; ? & Gt; & Lt; / Div & gt;  

I try to display in the site

   

This code is fully displayed in the source code but the PP echo code has not been treated as normal txt / has not been executed. I also tried to include it through an additional file.

Sample code new-products.php

   

I try to display in the site

  & lt; Php echo includes ('products / new-product.php'); ? & Gt;  

did not work ... if I put the code "new_p_dis" directly into the site or this kind of new product Php file

  & lt; Div class = "new-products" & gt; & Lt ;? Php echo $ new_p_img; ? & Gt; & Lt; / Div & gt;  

This works fine, but I have to re-code the whole site ..... no choice: (

Is it Is it possible that "new_prakash" unavailable "preprocal" is unavailable and then enter the last code in the page?

Thx

PS: Evil () is not an option;)

PPS: The above code is just a simple sample, the actual code is more complex, the wires are all dynamically created by PHP and in the database I just need a starting point:

Actually it works. .. with a work around. Everything I did was to create a function where I had caught the stored variable, he said what I wanted and then "called it" in my page.

  function main_p_lnk_shortcode () {global $ uf_vars; $ P_lnk1 = '& lt; A href = "'. $ Uf_vars_lnk.'" Title = "'. $ Uf_vars_nam.'" & Gt; & Lt; IMG src = "'. $ Uf_vars_img.'" Alt = "" /> & Lt; / A & gt; '; Return $ p_lnk1; } Add_shortcode ('main_p_lnk', 'main_p_lnk_shortcode');  

In this case I added a WP-ShortCode

I did all those other wars that had the php tag in them, loaded, then manipulated, Straight back function or shortcode ....


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -