Last active
August 30, 2016 08:12
-
-
Save cyberwombat/49afe346b11fc290cbd328aad8a4c6c2 to your computer and use it in GitHub Desktop.
preg_replace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$html = | |
"<div class=\"row home-pg-feed-item pl0 pr0 ml0 mr0\" data-type=\"video\">" . | |
"<div class=\"col-lg-4 col-xs-4 pl0\">" . | |
"<a href=\"/clinical-dialogue.php?v={{ url }}\"><img src=\"{{ thumb-sm }}\" alt=\"img\"/></a>" . | |
"</div>" . | |
"<div class=\"col-lg-8 col-xs-8 pr0 \">" . | |
"<h4 class=\"mb5\">{{ title }}</h4>" . | |
"<a href=\"/clinical-dialogue.php?v={{ url }}\" class=\"watch-link\">Watch the video</a>" . | |
"<p>{{ summary }}</p>" . | |
"</div>" . | |
"</div>"; | |
$item = array( "url" => "THEURL"); | |
foreach($item as $key => $value){ | |
$html = str_replace("{{ " . $key . " }}", $value, $html); | |
} | |
echo $html; | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment