Skip to content

Instantly share code, notes, and snippets.

@MikSDigital
Created November 25, 2016 09:17
Show Gist options
  • Save MikSDigital/19efe11be63c7970fa0f0baea9e3c68f to your computer and use it in GitHub Desktop.
Save MikSDigital/19efe11be63c7970fa0f0baea9e3c68f to your computer and use it in GitHub Desktop.
replace string
<?php
/* replaceTags Snippet
USAGE:
[[replaceTags?
&content=`[[%mt4se-amuk-minipage-1-p-1? &namespace=`main_uk` &topic=`MiniTerminal`]]`
&link2downloadPage=`[[~[[BabelTranslation? &contextKey=`[[*context_key]]` &resourceId=`2394`]]]]`
&website_link=`[[~[[++site_start]]]]`
]]
OR
[[replaceTags?
&content=`[[%mt4se-amuk-indicators-19-p-1? &namespace=`main_uk` &topic=`Indicators`]]`
&youtube_link=`[[++youtube_link]]`
&tutorial_video_connect=`[[++tutorial_video_connect]]`
]]
*/
$tags = array(
'[download]','[/download]',
'[youtube_link]','[/youtube_link]',
'[tutorial_video_connect]','[/tutorial_video_connect]',
'[website_link]','[/website_link]',
'[tutorial_video_minipage]','[/tutorial_video_minipage]',
'[tutorial_video_tickchart]','[/tutorial_video_tickchart]',
'[tutorial_video_tradeterminal]','[/tutorial_video_tradeterminal]',
'[link_tr]','[/link_tr]',
'[link]','[/link]'
);
$replacements = array(
"<a href='$link2downloadPage' class='link'>","</a>",
"<a href='$youtube_link' class='link'>","</a>",
"<a href='$tutorial_video_connect' class='link'>","</a>",
"<a href='$website_link' class='link'>","</a>",
"<a href='$tutorial_video_minipage' class='link'>","</a>",
"<a href='$tutorial_video_tickchart' class='link'>","</a>",
"<a href='$tutorial_video_tradeterminal' class='link'>","</a>",
"<a href='$link_tr' class='link'>","</a>",
"<a href='$best_execution_policy' class='link'>","</a>"
);
echo str_replace($tags, $replacements, $content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment