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>
Related
I have researched some answers that talk about php, javascript, iframes etc. but I have tried a couple and none of them work. I am new to HTML coding.. and coding in general!
<link rel="menu" href="menu.html"> does nothing
<!--#include virtual="/menu.html" --> does nothing (presumably because its a comment?)
<iframe src="page.html"></iframe>
or object... both place the menu in a silly little scroll box.
I want to run my menu on my page as if it were a function in C. Where I can just include it, and it be there, or just link it.
Thanks for the help!
Ryan
webpage file: biology.html
menu file: menu.html
<div class="container">
<img src="homeicon.jpg" width="50" alt="Home">
<div class="redhover">
<div class="dropdown">
<button class="dropbtn">GCSEs</button>
<div class="dropdown-content">
Chemistry
Biology
</div>
</div>
<div class="dropdown">
<button class="dropbtn">A-Levels</button>
<div class="dropdown-content">
Chemistry
Biology
</div>
</div>
<div class="dropdown">
<button class="dropbtn">University</button>
<div class="dropdown-content">
Telecommunications
Electronic Engineering
</div>
</div>
<div class="dropdown">
<button class="dropbtn">More</button>
<div class="dropdown-content">
About me
Youtube
</div>
</div>
</div>
</div>
You can use php to include files on other pages. Here is some example code to get you started:
<?php
require_once('menu.php');
?>
You can put this in your HTML page appropriately, however you must make sure that php can be processed on your server and the file containing php code must end in the .php extension.
There are also other methods of including files via php, see here:
http://php.net/manual/en/function.include.php
and
http://php.net/manual/en/function.require.php
Edit - I'm not a big fan of this approach, but it will work on Github pages.
Create a file called nav.js with your menu defined as a js variable, then use javascript to insert it into an empty div created on each page. This way to update your nav you only have to ever edit nav.js Not pretty but it works
nav.js
var navigation = "<nav>";
navigation += "<ul>";
navigation += "<li>Home</li>";
navigation += "<li>About</li>";
navigation += "</ul>";
navigation += "</nav>";
document.getElementById("navigation").innerHTML = navigation;
Other pages
<div id="navigation"></div>
<!--rest of page goes here.-->
<script src="nav.js"></script>
Fiddle: https://jsfiddle.net/ze3hLxx8/1/
There are multiple ways to include a file into another depending on the backend technology you wish / want / need to use.
PHP
The most common way to do it in php is by using the include or require statement inside a php file.
In your specific case your biology.html file must be converted to a biology.php file and then you can add the relative code to include the file:
<?php include('menu.php');?>
This simple statement will add the content in your menu.php file to the current page. This will not work if php is not present on the server and obviously will not work locally without a local development environment
The differences between require and include can be found on the official documentation:
include: http://php.net/manual/en/function.include.php
require: http://php.net/manual/en/function.require.php
SSI
Another method is to use Server Side Includes. To use the SSI it must be supported and enabled on the webserver. To use SSI you need to change the extension from biology.html to biology.shtml and then add the following statement:
<!--#include file="menu.html" -->
More information on server side includes can be found on wikipedia: https://en.wikipedia.org/wiki/Server_Side_Includes
I'm integrating an iframe with dynamic php content in its src on a checkout congratulations page. When the process is complete the iframe with code shows in Firebug, but not on view source in the browser. If I refresh the page the content shows in the browser view source. This, is what I believe, is causing the integration to fail because the iframe is not being picked up by the online service we are using.
Its a Wordpress so the final page calls get_header(); then html/php then get_footer();. Everything in between the header and footer does not show on the view source until I refresh the page, very odd. I tried googling but I found nothing and I'm not sure what even may cause it or where to begin.
Any experience with this?
Edit.
below is the code, everything inside of and including section1 div does not show in view source.
<?php get_header(); ?>
<div class="section1">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<iframe here>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
Edit:
I still don't know why, but it had to do with destroying all PHP session and browser cookies. Time to mark this one closed. If I ever figure out why,
I'll edit this question.
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 couldn't find any other info about anyone with this problem... I am not using .page() anywhere, i even unlinked my exterenal javascript file, and it still happens.
I navigate using a navbar and randomly (not always) it will start reloading the page in an infinite loop. and there is this 1 page, that has nothing special that will always happen if i press f5 to reload it, but if i come from another page... it doesnt happen o O it's so weird.
I'm using php and jqm 1.4.2 with jquery 1.10.2. I would post code, but can't really pinpoint anything.
On the page that i can press f5/refresh and it always does this bug, i tried removing all content, and php, other than includes/header/footer partials and it still happens...., removing my js from header and it still happens, the only conclusion I can come to is jqm 1.4.2 jquery or my php settings, which i am clueless on what to do. Any idea? This site used to be in jqm 1.2.0 and don't remember having this problem then.
EDIT: It seems removing the _footer.php partial stopped the bug this is its contents:
<?php
$navCSS = "ui-btn-active ui-state-persist";
?>
<div data-role="footer" data-position="fixed" data-tap-toggle="false">
<div data-role="navbar" data-iconpos="top">
<ul>
<li>Quarts</li>
<li>Nouvelle</li>
<li>Dispo.</li>
<li>Paies</li>
<li>Autres...</li>
</ul>
</div>
</div>
<!-- page end -->
</div>
</body>
</html>
EDIT: removing data-prefetch stops the issue, but i wanted to prefetch pages for smooth navigation and make it feel like an app, why does it cause this issue?
External pages/links are being prefetched several times as you are using the same navbar internally for each page. Your solution is to use an External footer and navbar which can be accessed from any internal or external page.
<body> <!-- or page container div -->
<div data-role="page">
</div>
<!-- external footer -->
<div data-role="footer" data-theme="a">
<div data-role="navbar">
</div>
</div>
When using external widgets, you need to initialize them manually by calling .toolbar() and then .enhanceWithin() to initialize inner widgets.
$(function () {
$("[data-role=footer]").toolbar().enhanceWithin();
});
I'm new to PHP and i use the include function to include a header file that has my db connections and my menu. On a body page I'm using a iframe to include a aside that needs to go on many different pages. The issue arises when i hit click on one of the hyperlinks of the aside that is in the IFRAME it will take me to the proper page BUT will RE-include the header in that portion of the code. I was wondering if there is any alternatives OR ways to insure the header doesn't reload in my iframe. Here is a copy of my code.
Main PAGE
<?php
include_once("include/header.php");
?>
<div id="content">
<div id="left" class="sidebar">
<iframe src="aside.php" height="550" frameborder="0" width="210" scrolling="no" allowtransparency="true" rel="nofollow"></iframe>
</div>
Aside page
<div class="imgholder">
<p class="employeename">Pablo Israel Penaloza</p>
<img src="img/Pablo-PeƱaloza.jpg" width="202" height="150" class="imgemployee">
<div class="sidebarmenu">
<ul id="sidebarmenu1">
<li>Informacion Personal</li>
<li>Contacto</li>
<li>Contact de Emergencia</li>
<li>Dependientes</li>
<li>Imigracion</li>
<li>Deberes</li>
<li>Salario</li>
<li>Supervisor</li>
<li>Calificaciones</li>
<li>Membresias</li>
</ul>
</div>
<!--End sidebarmenu1-->
</div>
Thank you
You'll need to use javascript for the detection, or make separate URLs for pages that will be included in the iframe. This should help you:
Check if site is inside iframe
To not use an iframe would be best.
It's much easier if you just use include(). You can make the content that would reside in the iframe inside of a scrolling DIV instead. Modern sites do this and update the <div> with AJAX.
To make it scroll
<div style='width:210px;height:550px;overflow:auto'>
<?php include($_SERVER['DOCUMENT_ROOT'].'/includes/aside.php'); ?>
</div>
Static
<div style='width:210px;height:550px;'>
<?php include($_SERVER['DOCUMENT_ROOT'].'/includes/aside.php'); ?>
</div>