Skip to content
Advertisement

Tag: include

Include external javascript file in header navbar file not found

I have the following folder structure: website.com/index.php website.com/page/asd.php website.com/header.php website.com/js/file.js header.php contains: index.php contains: asd.php contains: So file.js will work on index.php, but file.js doesnt work on asd.php. On asd.php the browser want to get /pages/js/file.js (which doesnt exist) and not /js/file.js How can I handle this problem? Thank you. Answer Start path of your file with / This will

How to include multiple html file in another phtml file?

I would like to include several file in Magento 2 in one phtml file. The project was in laravel at first and looks like this : https://i.imgur.com/XpUbynf.png So now I need to import all the project in a Magento 2 project but the semantic is different. I have tried this so far but doesnt work : https://i.imgur.com/hewweJg.png The files I’m

How to solve the fatal error in require_once

My project has two entry point for example File 1:/index.php ( first entry point) – here we include the config form the config folder File 2:service/service.php – here we include the config form the config folde if i call the File 2:service/service.php has no fatal error but when i call the File 1:/index.php it became the fatal error as failed

Output flickers if I include HTML in PHP

for my website i have some static header/footer HTML and some dynamic content generated by PHP. When it comes to render the output I just include a file with HTML inside from my PHP code. This works perfect – also when I switch between pages. But I also need some header.hmtl and footer.html that contains the static information (text and

PHP Securely include files + handle invalid parameters

I’m having a little problem. I want to securely include files based on the $_GET Parameter from a subdirectory + handle if the parameter is not valid. This is my Code. Sorry I know it is a noob way of solving this. How can I improve it? Any Suggestions/Help would be highly appreciated Answer I would use a ternary to

register_shutdown_function doesn’t pass variables…?

I’ve run into some difficulties with register_shutdown_function() in PHP. I have a header.php file which contains: $_SESSION contains an array called “user”, containing things like the user ID and their username. I extract $_SESSION simply so I can use $user[“id”] rather than $_SESSION[“user”][“id”]. Then, in footer.php I have this code: to put the info back into the session, in case

Advertisement