running a script in a php module - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: running a script in a php module (/showthread.php?tid=78498) Pages:
1
2
|
running a script in a php module - richb201 - 01-29-2021 I have a php module and in it I am trying to show a different logo depending on the "branding". I have the code below in a footer and I would expect at least one of the logos to appear. But none do. What am I missing? Code: <div class="row"> RE: running a script in a php module - craig - 01-29-2021 It's not working because you're trying to output HTML image tags in a javascript tag (<script>). RE: running a script in a php module - richb201 - 01-29-2021 Is there an html version of a case statement? Perhaps I should have a php case statement instead? RE: running a script in a php module - craig - 01-30-2021 No there isn't, HTML doesn't support logic. If all you need to do is selectively display an image, you should use PHP. Code: <?php (Also, creating a switch() on the value of "1" will always result in the same image appearing) RE: running a script in a php module - richb201 - 01-30-2021 (01-30-2021, 05:00 AM)craig Wrote: No there isn't, HTML doesn't support logic.-yes, this is just for testing! RE: running a script in a php module - richb201 - 01-30-2021 I copied the code exactly. $src = base_url("assets/themes/default/images/{$img}"); this is what is being generated: <img src='http://localhost/assets/themes/default/images/Logo - Research Study Toolkit(3).jpg' style='float:left;margin-top:5px;z-index:5' alt='Logo'> And here is the attempt to print it: echo $img; This does not give an error but the logo just shows up as a broken "Logo". I think the problem is that path is wrong. I tried copying the path directly into the browser, but that also fails. Is there a better way to get the path to the file? RE: running a script in a php module - craig - 01-31-2021 Where is "Logo - Research Study Toolkit(3).jpg" located? RE: running a script in a php module - richb201 - 01-31-2021 It is in a docker container (as is the rest of my code). Here is the full path to it on my hardrive. /opt/docker-substantiator2/app/assets/themes/default/images/Logo - Research Study Toolkit (3).jpg RE: running a script in a php module - craig - 01-31-2021 (01-31-2021, 06:48 AM)richb201 Wrote: It is in a docker container (as is the rest of my code). Here is the full path to it on my hardrive. And where is CI's index.php? To display assets properly, they must be in a directory accessible by the web server. RE: running a script in a php module - richb201 - 02-01-2021 It is at /opt/docker-substantiator2/app/index.php |