-2

ı want to add following code between < div >here < /div > tags

for example:

$ad_code = '<div>include 'ban.php'; </div>';

but it doesn't work how can I do this

blurain82
  • 25
  • 7
  • I don't get what You want, here You have article with description how ask good question http://stackoverflow.com/help/how-to-ask – kuba_ceg Jan 18 '17 at 09:22
  • Sorry little english, my problem div between I want to show paragraph banner in themes function.php file I can not use php with code blog. The part of code I want to add to php sample: include 'ban.php'; – blurain82 Jan 18 '17 at 09:28
  • Is your problem actually about the inclusion of single quotation marks within a string? – LordWilmore Jan 18 '17 at 09:44
  • Possible duplicate of [require/include into variable](http://stackoverflow.com/questions/5948395/require-include-into-variable) – Tom Jan 18 '17 at 09:48

2 Answers2

0
   <div>
   <?php include ban.php; ?>
   </div>

It's really incredibly easy, and I can't believe Google could not have solved your problem here.

This is on the presumption you're putting this straight onto the page. It's hard to answer really as you've given us almost nothing to go on.

Following a little more info, this is a possible duplicate of; require/include into variable

Community
  • 1
  • 1
Tom
  • 4,257
  • 6
  • 33
  • 49
0

Let me assume ban.php

<?php
echo '<div>Banner</div>';
?>

and on your php file.

<?php
ob_start();
include('./ban.php');
$ad_code = ob_get_clean();
echo $ad_code;
?>

I think this is what you want, if i had understood your question correctly.

or try this

<?php
$ad_code = file_get_contents('./ban.php');
?>
Manikandan
  • 502
  • 1
  • 7
  • 17