Use php as external javascript file in CakePHP 2.0
-
I know that you can use a php file as an external javascript file like below: <script type="text/javascript" src="myscript.php"></script> But how would you do this in CakePHP 2.0? $this->Html->script('external_js', false); automatically adds the .js extension. This page explains what I want to do: http://nuts-and-bolts-of-cakephp.com/2009/04/03/blend-php-and-javascript-in-cakephp/ but it's out of date. This method doesn't work with CakePHP 1.3+. Any ideas?
-
Answer:
You can get around the automatic addition of the .js extension by adding a question mark at the end of the filename. The Html->script function will add '.js' to any input that does not end in '.js' AND does not contain a '?'. $this->Html->script('external_js.php?');
Brian at Stack Overflow Visit the source
Related Q & A:
- How do I delete profile 2.0 and change it back to 1.0?Best solution by Yahoo! Answers
- How do you change your profile from 2.0 to 1.0?Best solution by Yahoo! Answers
- Where can I find a small end 4 pin fire wire and a 5 pin mini usb 2.0 cable that connects a external harddrive?Best solution by Yahoo! Answers
- How do you change layout 1.0 to 2.0?Best solution by freecodesource.com
- What's the difference between Web 3.0 and Web 2.0?Best solution by wiki.answers.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.