Home Insert php and html into div in php variable
Reply: 0

Insert php and html into div in php variable

user9523 Published in September 19, 2018, 3:42 am

I have a php variable as such:

$output_map[$the_ID]['map'] = '<div class="marker" data-lat="'.$get_google_map['lat'].'"></div>';

I want the code below inside the "marker" div that's within the above var:

<p><?php echo $location['address']; ?></p>
<p><?php the_field('description'); ?></p>

The <<<EOD method isn't working and going in/out of php tags doesn't seem to work. It seems like it's going to look messy, I wondering what is the syntax I'm missing here?

share|improve this question
  • 1
    Is there a reason you cannot include that code inside the variable with the other html? – IncredibleHat Jan 13 at 0:58
  • Change the_field to get_field and then just concatenate it in, like your already doing. – Lawrence Cherone Jan 13 at 0:59
  • Oh, is the_field() some wordpress thing? Then nevermind... I'm out. – IncredibleHat Jan 13 at 1:04
  • It is unclear what you're requesting. Show us the resulting code that you want to have in the end. – user7941334 Jan 13 at 1:07
  • Yes @LawrenceCherone that is how I'm doing it. the_field is a wordpress thing yes (using Advanced custom fields), but it's kind of redundant as I can't even get the plain echo to show up on my site. – patrice Jan 13 at 1:11

2 Answers 2

active oldest votes
up vote 0 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.352181 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO