2

Just wondering if someone would be kind enough to help me with a problem i am having.

This is the code that i am currently using for my E-junkie View Cart button on my Drupal site:

<a href="https://www.e-junkie.com/ecom/gb.php?c=cart&cl=206570&ejc=2" target="ej_ejc"       class="ec_ejc_thkbx" onClick="javascript:return EJEJC_lc(this);"><center><img src="http://www.e-junkie.com/ej/ej_view_cart.gif" border="0" alt="View Cart"/></center></a>
<script language="javascript" type="text/javascript">
<!--
function EJEJC_lc(th) { return false; }
function EJEJC_config() {
EJEJC_POSTCALL=true;
}
function EJEJC_shown() {
jQuery("#imgHeader").attr("src", "http://www.eastwestcards.com/banner2.png");
}
// -->
</script>
<script src='http://www.e-junkie.com/ecom/box.js' type='text/javascript'></script>

When i use this code on a normal HTML page the pop up is very nice and clean. However, when i try to use this code in a block on drupal the pop-up still works but there is no banner and the tables for the shopping cart all messy and etc.

Another thing that I am wondering about is my twitter feed doesn't work.

I have tried enabling the PHP module and set the input filter to PHP code and the twitter feed now shows but i am unsure if this is an efficient way to fix the problem. When i did this for the code above the banner of my cart started showing but the tables and etc. were still messed up.

I've been reading some FAQs and some people are suggesting that I should make exceptions in my theme's CSS files so that it does not affect the pop-up cart on my site but I do not know how to do this.

Apologies for the chunks of text, thank you in advance for any help.

1
  • Did you try adding your scripts to drupal with drupal_add_js()? Its not that difficult to add it to your theme's preprocess function. Check some examples. – Perisdr May 20 '12 at 10:01
2

Inputing PHP or Javascript through the UI is almost always a bad idea, and can happen to be impossible in some cases, for security reasons.

I recommend another approach, for example creating a block in a custom module with the various block hooks.

This way, you won't bypass Drupal security and you'll have a much more versatile and robust solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.