PHP not working in production - php

I building my 1st responsive & dynamic website. I tested it locally on WAMP and all my sections show up but when I moved it to my 1and1.com production server my php includes didn't work. I checked the PHP versions and WAMP and 1and1 are using PHP 5.4.
Can you tell me what I overlooked or did wrong?
The PHP code is:
<?php include_once('/includes/Footer.php'); ?>
My footer looks like this:
<div id="footer">
<footer class="row">
<div class="large-12 columns">
<hr>
<div class="row">
<div class="large-8 columns">
<p>Jersey City Dance Academy 107 Westside ave. Jersey City, NJ 07305</p>
</div>
<div class="large-4 columns">
<ul class="inline-list right">
<li>Terms of use</li>
<li>Privacy Policy</li>
<li>Site Map</li>
</ul>
</div>
</div>
</div>
<div class="large-12 columns">
<div class="row">
<div class="large-8 columns">
<p>(201) 435-8943 <a mailto="Info#JerseyCityDanceAcademy.com">Info#JerseyCityDanceAcademy.com</a></p>
</div>
</div>
</div>
</footer>
</div> <!-- end #footer -->
*******UPDATE Jan 25th, 2014*****************
I moved all CSS, JS & includes files so the webpage could find them in the relative path but my includes are still not showing up. Picture showing file locations in FTP program.
http://i.stack.imgur.com/R5H94.jpg

additional 1and1 may be Case sensitive while your WAMP isn't. Check case of your filenames, Footer.php is not footer.php

You are using absolute directories for the include command.
<?php include_once('/includes/Footer.php'); ?>
Absolute directory may be different in your new hosting. You should either check the directory in which the Footer is contained or use relative directories.

<?php include_once('includes/Footer.php'); ?>
This will give you a relative path, which your local and live server may read differently.
This assumes that the 'includes' folder is in the same place as index.php
Alternatively (and the recommended method) is to have a path to the root via a variable in front of your includes, like:
<?php include_once($site_root.'includes/Footer.php'); ?>
You could even define that as a constant or put all your important data (like root paths) in an array.

Related

How to make different layout.php files and include into different languages?

I'm interested in solving this problem, since I can't figure out what to do. I made a fade in/out text under menu for mobile version to show some information, but since the code has to be between two HR lines I added the code to layout.php file, and now I can't put that on 3 other languages because it's on German.
<div class="">
<div class="">
<hr class="" />
<div class="" style="">
<div class="">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<hr class="" style="" />
</div>
</div>
This is the code for that fade In/Out effect and changing from one to another, I managed to do that with nth-child selector, nothing hard...
My web site has 4 languages, but every language has 2 web sites that are different. I'm not using any framework just bare code. I've tried searching for anything that would be connected to that HR line so I could add manually on every site another line and that text between them, but there is none because it uses layout.php to show that line.
<div id="" class="">
<? if ($special_fullscreen != true): ?>
<div id='' class="">
</div>
<div class="">
<div class="">
<hr class="" style="" />
<div class="" style="">
<div class="">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<hr class="" style="" />
</div>
</div>
<div class="">
<div class="">
</div>
</div>
So, I would like to hear an idea that would resolve this issue, like making a different layout.php for every language or something like that and how would that be possible. I know that this code probably doesn't have anything to do with the problem, but I'm in a hurry and just tried to copy at least something... Thanks in advance :D
I am completely not sure if I know what you mean but it may be helpful info.
If you want to include different files on the same page depended on language - you can set cookie with info about chosen language and then, based on that, load proper layout.php file for it.
You can also make all language versions in one layout.php file, include it in proper place and make if statement checking which content should get displayed (inside that layout.php file) - also based on value of COOKIE.
Instead of cookie, you can also use $_SESSION but that may not work on the way you really want (according to my understanding of your problem).

Read php file if I am in a folder

I created a footer.php file:
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col col-md-5">
<p>Copyright © 2018 Nens Events.</p>
</div>
</div>
</div>`
and it is located on a folder like this one:
/php/footer.php
All I want is to read it on a subfolder like this one: /events/na/1.php
but when I use this code, it doesn't read the footer.php file, does someone know what I am doing wrong?
<?php
echo file_get_contents("/php/footer.php");
?>
Use include() or require() function to join your codes into your script.
So the code for reading(in your terms) will be like this
<?php include 'php/footer.php'; ?>
If the site is on root page, use absolute path like this.
<?php include '/php/footer.php'; ?>
It should work! Give a try.
Use require('php/footer.php') for better coding.

Bootstrap grid not working when file is included

I already made a homepage including the grid system of bootstrap, but now im using mainly includes to keep everything tidy but the grid system doesnt seem to work at all. even if i copy the example code of bootstrap itself.
this is the first code of my content php file. including obviously the row part. These are stacked ontop of eachother not next to eachother.
PS: the .content-wrapper has no styling yet so its not affecting anything and the .content has only top and bottom padding.
<div class="content-wrapper">
<div class="content">
<h1>The Test Heading</h1>
<p>
text
</p>
</div>
<div class="row">
<div class="col-sm-6 col-md-6">
<div class="thumbnail">
<img src="..." alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p>Button Button</p>
</div>
</div>
<div class="thumbnail">
<img src="..." alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p>Button Button</p>
</div>
</div>
</div>
</div>
here is the index.php file i got with the content area
<div class="container">
<!-- Navigation area -->
<?php include_once ("php/navigation.php");?>
<!-- Carousel -->
<?php include_once ("php/carousel.php");?>
<!-- Content area -->
<?php include_once ("php/content.php");?>
</div> <!-- end of container -->
im not sure if it has to do something with including a file and the grid system, but carousel, container etc all working fine so it should find the css file after being included.
Sidequestion: is a method like this useful? working with includes only? or is it rather non-practical?
So what do u want to do with grid system, because you only have one col so it will just go from begining of file to col 6 it will look like it doesnt do anything rly? You can put lets say and then your div with col and it will move it and so on.

Why multiple "includes() " of files are causing the browser to load slow in mobile JQM based website

I know this question have been asked many times on stack one of them is probably this Link but I could not get my answers from these links .
So my question is I am loading multiple files in a form using php includes() which is causing the page load time almost 30 seconds that is too much than the normal execution time .
Although the same method works fine in my desktop version check the link Link here the page is loading fine .
My code looks something like this
HTML
<div id="DIVC3" class="divs_details">
<?php include(dirname(__FILE__)."/cat3.tpl.php")?>
</div>
<div id="DIVC4" class="divs_details">
<?php include(dirname(__FILE__)."/cat4.tpl.php")?>
</div>
<div id="DIVC5" class="divs_details">
<?php include(dirname(__FILE__)."/cat5.tpl.php")?>
</div>
<div id="DIVC6" class="divs_details">
<?php include(dirname(__FILE__)."/cat6.tpl.php")?>
</div>
<div id="DIVC8" class="divs_details">
<?php include(dirname(__FILE__)."/cat8.tpl.php")?>
</div>
<div id="DIVC9" class="divs_details">
<?php include(dirname(__FILE__)."/cat9.tpl.php")?>
</div>
<div id="DIVC10" class="divs_details">
<?php include(dirname(__FILE__)."/cat10.tpl.php")?>
</div>
<div id="DIVC11" class="divs_details">
<?php include(dirname(__FILE__)."/cat11.tpl.php")?>
</div>
<div id="DIVC12" class="divs_details">
<?php include(dirname(__FILE__)."/cat12.tpl.php")?>
</div>
<div id="DIVC13" class="divs_details">
<?php include(dirname(__FILE__)."/cat13.tpl.php")?>
</div>
<div id="DIVC15" class="divs_details">
<?php include_once(dirname(__FILE__)."/cat15.tpl.php")?>
</div>
<div id="DIVC16" class="divs_details">
<?php include(dirname(__FILE__)."/cat16.tpl.php")?>
</div>
<div id="DIVC17" class="divs_details">
<?php include(dirname(__FILE__)."/cat17.tpl.php")?>
</div>
<div id="err_desc" style="visibility:hidden; display:none;">
<?php
$long_desc=strlen($t_POST['im_desc']);
if ($long_desc>0 && $long_desc<15) {
?>
<span style="color:#FF0000;font-weight:bold; font-size:12px"> <?=$this->translate->translate('ERR_DESC','nucleo','Descripción deficiente');?></span>
<?php
}
</div>
Please let me know if you have similar problem before
Thanks & Regards
Several things are causing this problem but let go from the beginning.
jQuery Mobile can't style and enhance page content before web server handles all responses back to your browser client. So lets say your page has additional cca. 50 files (different images, js and css files etc.) plus there's a loot of PHP includes on your server side.
In this case server side PHP will first try to handle all file includes. But this process is not parallel, it will not happen all at once. This is the first performance block, and looking it your PHP code it is probably number one culprit.
Second step is also problematic, lets say PHP has finished content generation and response is sent to client browser. Again responses will not be handled all at the same time, each web server has a limit of how much responses can be handled per single session. So if you have for example 50 files (different images, js and css files etc.) it will take at average 10x more time to load everything then it will take to load only 5 files (of course this differs depending on file sizes).

How to place a header image above navigation in WordPress

I am using theme Banshee on (http://adriangraphics.com/truturf/) and can't figure out how to put a header image (as seen on http://globalsynturf.com/) above the navigation. I want my logo, along with phone number, etc above the navigation on my WordPress site. I'm assuming I have to change the Header PHP, but unsure how.
In your header.php find:
<div class="row">
Then inside of this find:
<div class="3">
<div id="logo">
Take the contents of this entire div, and cut it.
Then above the <div class="row">, make the following:
<div class="row">
<div class="span12">
<div id="logo">
//rest of the logo code
</div>
</div>
</div>

Categories