1

How can I edit a javascript file using php. I want to change the file path dynamiacally is it possible to do with php. Please help me?

test.js is my file. this is for display images on frontend

from admin panel me create one folder named flower. then I will create one flower named folder and copy this test.js to that folder. after that I have to edit the file path of test.js file. how can I do that?

3
  • Do you want to edit the content of file or want to move from one path to another? Commented Dec 8, 2010 at 9:42
  • 2
    Please can you give a practical example of what exactly you're trying to do and explain what do you want to obtain? Commented Dec 8, 2010 at 9:42
  • Can you make the question more clear so that you can get what are you looking for? Commented Dec 8, 2010 at 9:47

2 Answers 2

3

Your PHP file will get executed on the server and an HTML file (usually) will be sent to the client. This file will contain a <script type="text/javascript">... line somewhere if you're including a javascript file. You can rewrite this line in your PHP file to make it pick up the file from somewhere else.

Sign up to request clarification or add additional context in comments.

Comments

2

Yes, it's possible, if you mean changing the <script src="..."> in your HTML.

Anyway, it's like

<script src=<?php echo '"' . $path . '"'?>></script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.