the logic as outlined in the attached file is working however I would like to move the inline script (line 8 to 354) into an external js file. only how ?
if I move the above to dtree.js, adjust function dTree(objName) for function dTree(objName, path) and adjust $path for path under icons and use
$jsfile = $baselink.$this->template.‘/js/dtree.js’;
how am I to pass $path to the script?
I am sorry if this is majorly basic but I’m only starting with learning js
could somebody please help me figure how to achieve that?
Note, the JS file is named php. The very first line of you JS file should have this,
Right after that line you will want.
$path = $_GET[‘path’];
Since you are using Heredoc, I have no idea if (how) this will work. Another workaround would be to use an include.
thanks for getting back to me!
unfortunately I’m not getting it to work.
I created a new file called tree.php with the following snippet at the very top:
$path = $_GET['path'];
followed by the lines 25-378 of the attached file
in the attached file I have removed lines 25-378 and inserted above the heredoc snippet:
while my IDE does not show any syntax errors and there are also no errors displayed on user side the tree is not being displayed anymore
would you have any advice what I’m overlooking?
hmmm! the second snippet in my second post is wrong. should be:
$baselink = $this->interface->getCfg('live_site').'/components/com_component/templates/';
$jsfile = $baselink.$config->template.'/js/tree.php';
that however still doesn’t make it work