How do I add an IF statement to a Magento CMS Page using Javascript
I need to place a conditional statement in a Magneto CMS Page to process a static block only if the condition is met.
I only have very basic knowledge of javascript and am unsure how to include the Magneto static-block processing within the javasc开发者_如何转开发ript conditional statement. This is as far as I have got:
<script type="text/javascript">
if (location.href.substring(0,5)!='https')
{
{{block type="cms/block" block_id="leaderboard"}}
}
</script>
How do I tell the javascript to process the "{{block type="cms/block" block_id="leaderboard"}}" bit?
Also, is using javascript the best way to add a conditional statement to a Magento CMS page?
You can't do this in JavaScript. JavaScript runs on the client Web browser, but you need to alter this at the server.
You'll need to break into the template PHP code inside of Magento.
精彩评论