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).
Related
I'm developing a web-based application using Framework7 (http://www.idangero.us/framework7/).
I'm doing well but now that I have come to integrate my login/member system I have encountered a problem with hyperlinks.
I've spent couple of hours trying to figure it out but have still come up short.
Basically I have three links:
<div class="pages navbar-through toolbar-through">
<div data-page="index" class="page">
<div class="page-content">
<div class="content-block">
<div class="content-block-inner">
Hello <?php echo htmlentities($_SESSION['user']['username'], ENT_QUOTES, 'UTF-8'); ?>, secret content!<br />
Memberlist<br />
Edit Account<br />
Logout
</div>
</div>
</div>
Memberlist.php and edit_account.php do not work but logout does.
Visiting the files directly in my browser (eg domain.com/memberlist.php) loads the file. They just do not load from this page so something is clearly wrong with it.
I've tried to include target="_self" and use other styles of linking content as explained in the Framework7 documentation but there is nothing about the problem I'm experiencing.
it important to write exact page name in data-page attribute value
<div class="page" data-page="about">
After digging around some more in the documentation I was able to solve my issue.
Linking in Framework7 requires every page linked to to have some specific code for parsing over AJAX.
<!-- That is all we have in about.html file -->
<div class="page" data-page="about">
... About page content goes here
</div>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
CLARIFICATION: Being that I've never used PHP, it was unclear how to format the PHP file, so that when you include it in the index, then header(nav bar) would show up. No posts explained why I had to change my index.html to index.php to make it work. And again, being that I haven't used PHP, I was under the impression that changing the extension meant that I would have to convert my HTML code to PHP commands. I was trying to avoid having to change my whole code around. That's where the confusion was.
I was going to delete the question once I got it figured out. Then again, I'm sure I'm not the only person that may run into this while making their first website.
SOLUTION. Save only the nav code in html language with a PHP extension (header.php). Change index/home file from .html to a .php extension (don't have to modify any code. but accepts the include prompt). Then, include the header.php in your index.php. Same goes for your footer. Thanks for the help everyone.
*ORIGINAL POST: Through another post, I was told it would be easier to use a nav/footer on multiple pages by using PHP.
I created a file and tried including it and it is not displaying. I'm not sure what I am doing wrong.
There is some CSS in my nav bar as well, do I need to import the css file in the PHP file? or does the index.html file automatically attach to the included (php) file.
PHP Code:
<?php
echo '<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
</nav>';
?>
HTML Code (include):
<body>
<?php include '/header.php';?>
....other code....
</body>
If there's a problem with the PHP file, if I'm missing something, can someone show an explain please?
no need to add <?php ?> code in the header file just keep it as it is :
Create a new file named header.php and add this code to it
<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
Include header.php anywhere you want
Remove the <?php tag from your code. As you generated html output. <?php tags are used to generate output by php.
<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
</nav>
If you want to use php tags, than you have to write the code in this way:
<?php
echo '
<nav>
<div>
<a href="/">
<div id="logo"><img src="/Images/7serviceLOGOblue2.png" alt="Home"/></div>
<div id="headtag"><img src="/Images/title.png" alt="Home"/></div>
<div id="tagline"><img src="/Images/tag_line.png" alt="Home"/></div>
</a>
</div>
<div>
Home
<a href="/about.html" >About</a>
<a href="/services.html" >Services</a>
<a href="/pricing.html" >Pricing</a>
<a href="/contact.html" >Contact Us</a>
<input id="srchbar" type="search" placeholder="Search">
</div>
</nav>
';
?>
Your problem is most likely the pathing of you include. Often you'd need to specify from the server root, and not just /header.php.
To specify your including-path, you could specify the root like this
include $_SERVER['DOCUMENT_ROOT']."/header.php";
You can also set the default include path in your php.ini file, thus making the $_SERVER['DOCUMENT_ROOT'] an automatic process, that can be done with running this code, that will alter your php.ini file.
ini_set('include_path', '/usr/lib/pear');
As others have pointed out, you don't need the contents of your /header.php to be echoed out as it's pure HTML. Anything that's included will be included the way it is, so having the contents of /header.php as pure HTML just makes for better practice, as it's easier to read.
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).
I'm working on a login system for a website in which the top right corner will change depending on whether or not the user is "signed in" (a check against a session variable). I am using the following to try and show only one these two states.
<?php if(isset($_SESSION['id'])): ?>
<div class="large-2 large-offset-5 columns">
<p class="right text-pad-top">#MuffinTheFox</p>
</div>
<div class="large-1 columns">
<img class="avatar" src="https://pbs.twimg.com/profile_images/429861192207982592/lxaKQ4Rp.jpeg">
</div>
<?php else: ?>
<div class="large-2 large-offset-7 columns">
<a class="right text-pad-top" href="login.php">Log in/Sign up</a>
</div>
<div class="large-1 columns">
<img class="avatar" src="http://placehold.it/50x50">
</div>
<?php endif; ?>
The problem is, when I upload the code to my server and run it, both HTML blocks display, regardless of the PHP statements.
There aren't any obvious errors and according to my research into the topic, this should work. Also, I tried the way without the endif; statement as well by using brackets, and that didn't work either. At this point I'm somewhat lost as to why this is happening and any help or insight would be appreciated.
Edit: Something of note, the PHP is embedded into a HTML document with a .html extension. I was under the impression that you could just inline php into a html document without issue, but I have a feeling that this might be the cause of the issue.
Your file is not getting parsed as PHP because PHP is not configured to parse .html files unless you tell it to. See this question for insight into how to do that. In the meantime, change your file extension to .php and it should start working as you expect.
I am getting this oddball extra <br> inserted into this page above the "Affiliate" title/section. http://londoncapital.biz/affiliate-program/
Using either Firebug or Element Inspector, I still cannot determine where this is coming from.
This is the generated HTML.
<div class="entry clearfix">
<div class="two_thirds"></div>
<div class="one_third last" style="text-align: justify;"></div>
<hr class="clear">
<p></p>
<div class="one_third"></div>
<p></p>
<p></p>
<div class="one_third"></div>
<br> (THIS SEEMS TO BE THE OFFENDING ELEMENT I THINK)
<div class="one_third last"></div>
<div class="clear"></div>
<br>
I have gone over the page coding in WP page itself and and all three of those sections are identical.
What am I missing here? Some errant code in some php file?
UPDATE INFO: This is the actual code from the WordPress page: http://pastebin.com/pwJbAGdg
I can't paste the whole code here because I'll be here forever trying to clean up the formatting from the paste.
Surely using this stuff in editor is really cool but if you REALLY need it you can just remove spaces, copy this stuff:
<div class="entry clearfix"><div class="two_thirds"></div><div class="one_third last" style="text-align: justify;"></div><hr class="clear"><div class="one_third"></div><div class="one_third"></div><div class="one_third last"></div><div class="clear"></div><br>
Open Wordpress Super editor and go to TEXT mode - !important
Paste it - should work.
But that's not the best coding sample :)