I have a simple php site that I built, but for some reason my photo gallery page takes a little long to load. Can someone tell what the problem is and how to speed up the load time?
Here is php code. By the way I coded everything within this one file (photography.php), with only references to images in another folder...
<?php
$thisPage="Photographer, Caribbean, Jamaica, Bahamas - Cheryl Blackerby";
$thisDescription="";
$thisKeywords="Caribbean, Jamaica, Bahamas";
include("header.php");
//include("html/photography.html");
?>
<div id="photography">
<div id='coin-slider'>
<div id="photos">
<a href="#" target="_blank">
<img src='photography/img_01.jpg' alt="Staniel Cay Yacht Club in the Exumas, Bahamas" />
<span>Staniel Cay Yacht Club in the Exumas, Bahamas</span>
</a>
<a href="#" target="_blank">
<img src='photography/img_02.jpg' alt="Junkanoo dancer in Inagua, Bahamas" />
<span>Junkanoo dancer in Inagua, Bahamas</span>
</a>
<a href="#" target="_blank">
<img src='photography/img_03.jpg' alt="Doctor's Cave Beach in Montego Bay, Jamaica" />
<span>Doctor's Cave Beach in Montego Bay, Jamaica</span>
</a>
<a href="#" target="_blank">
<img src='photography/img_04.jpg' alt="Paella at the Beach House, Eleuthera, Bahamas" />
<span>Paella at the Beach House, Eleuthera, Bahamas</span>
</a>
<a href="#" target="_blank">
<img src='photography/img_05.jpg' alt="Opening of the Supreme Court, Nassau, Bahamas" />
<span>Opening of the Supreme Court, Nassau, Bahamas</span>
</a>
<a href="#">
<img src='photography/img_06.jpg' alt="Flamingos on Inagua, Bahamas" />
<span>Flamingos on Inagua, Bahamas</span>
</a>
</div><!-- end photos -->
</div>
<p id="right-description"><img src="images/side-descrip-photos.jpg" width="20" height="90" alt="Photo Description" /></p>
<script type="text/javascript">
$(document).ready(function() {
$('#coin-slider').coinslider({ width: 840, height: 520, navigation: true, delay: 5000, links : false, hoverPause: true, opacity: 0.7, effect: 'practice', sph: 1, spw: 1 });
});
</script>
</div><!-- end photography -->
<?php
include("footer.php");
?>
Here is the link to the site: here
I would appreciate any advice on the issue and any coding techniques that would help.
Thanks,
Gary D.
Loads nice and quickly for me - impressively fast in fact.
I'd say it is bandwidth-heavy, and you tried it from a slow connection.
One thing about it is that you pre-load all your large images, even though you only show the top one. This is a good idea, except that they appear earlier in your code than the navigation on the right, so I imagine on a slow connection, there'd be some wait for all the large images to download before it shows the navigation on the right. You could get around this by pre-loading these images using a different method, using JQuery, so that the request to load those images doesn't come before other images on the page.
Start here: http://developer.yahoo.com/yslow/ that's a firefox plugin that will analyze your page for download bottlenecks. It could have nothing to do with your php code.
Related
This week our product pages have been not working as intended. When clicking the product image thumbnail to enlarge, the lightbox window loads and just continues to load, never displaying the image. It was working before and I have no access to these scripts and files, since they are loaded through PHP that I have no access to. We are on BigCommerce's platform, but BC will not help me because we have customized our template. I have poured through the source code and cannot find what could be causing this issue. Any help is greatly appreciated.
Link to a product page: http://www.inflatableboats.net/demo-zodiac-pro-open-650-t-top-neo-2016-with-twin-yamaha-f70-four-stroke/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/">
%%Panel.HTMLHead%%
<body>
<script type="text/javascript" src="%%GLOBAL_AppPath%%/javascript/jquery/plugins/validate/jquery.validate.js?%%GLOBAL_JSCacheToken%%"></script>
<script type="text/javascript" src="%%GLOBAL_AppPath%%/javascript/product.functions.js?%%GLOBAL_JSCacheToken%%"></script>
<script type="text/javascript" src="%%GLOBAL_AppPath%%/javascript/product.js?%%GLOBAL_JSCacheToken%%"></script>
<div id="Container">
%%Panel.Header%%
<div id="Wrapper">
%%Panel.WrapperBanner%%
<div class="Left" id="LayoutColumn1">
%%Panel.SideCategoryList%%
%%Panel.SideNewProducts%%
%%Panel.SideNewsletterBox%%
%%Panel.SideLiveChatServices%%
</div>
<div class="Content" id="LayoutColumn2">
%%Panel.ProductBreadcrumb%%
%%Panel.ProductDetails%%
<div id="Fees">
<p id="FeeHeader"><strong>Standard Fees Apply</strong></p>
<a class="tooltip" style="float: left;" href="#"> PDI: <span> <img class="callout" src="http://inflatableboats.net/template/feebox/callout.gif" alt="" /> <strong>Pre-Delivery Inspection</strong><br /> Standard Fee for services performed and products used on each new vessel, requested by all manufacturers to validate and assist in all warranties.<br /><br />We install a deep cycle marine battery, fully rig steering components, complete electrical and systems check. We conduct a full system check on the motor, fill with oil, fluids, and fuel, then test run in a test tank.<br /><br />Once everything is tuned and prepared, a sea trial is performed with two Specialists to achieve ideal RPM-to-top-speed ratio, ensuring the boat gets on plane properly, and all systems operate on water.<br /><br />Afterwards a full detail is performed on the tubes, deck, and hull to be turn-key ready for the customer. </span> </a>
<p style="float: left;"> </p>
<a class="tooltip" style="float: left;" href="#"> Destination Fee: <span> <img class="callout" src="http://inflatableboats.net/template/feebox/callout.gif" alt="" /> <strong>Destination Fees are set by Zodiac.</strong><br /> Standard Fee both vehicle and vessel dealerships are charged from a manufacturer to ship product to dealerships </span> </a>
<p style="float: left;"> </p>
</div>
<div id="quote">
<a class="btn lightbox-40737220632144" style="cursor: pointer;"><img id="quotebutton" style="" src="http://inflatableboats.net/template/img/request-a-quote.png" name="quotebutton" /></a>
<img id="financebutton" style="" src="http://inflatableboats.net/template/img/finance-button.png" name="quotebutton" />
</div>
%%Panel.ProductTabs%%
%%Panel.ProductDescription%%
%%Panel.ProductVideos%%
%%Panel.ProductWarranty%%
%%Panel.ProductOtherDetails%%
%%Panel.SimilarProductsByTag%%
%%Panel.ProductByCategory%%
%%Panel.ProductVendorsOtherProducts%%
%%Panel.SimilarProductsByCustomerViews%%
</div>
<div class="Right" id="LayoutColumn3">
%%Panel.SideCurrencySelector%%
%%Panel.SideProductAddToWishList%%
%%Panel.SideProductRelated%%
%%Panel.SideProductRecentlyViewed%%
</div>
<br class="Clear" />
</div>
%%Panel.Footer%%
</div>
<script>
$(document).ready(function(){
$("#ProductOtherDetails .ProductDetailsGrid .DetailRow").each(function(){
var label = $(".Label",this).text();
if ( label === 'PDI:') {
var pdiAmount = $(".Value",this).text();
pdiAmount = pdiAmount.replace(/\t/g,"");
pdiAmount = pdiAmount.replace(/\n/g,"");
//console.log("PDI is " + pdiAmount);
$("#Fees p:nth-of-type(2)").text(pdiAmount);
}
if ( label === 'DF:') {
var dfiAmount = $(".Value",this).text();
dfiAmount = dfiAmount.replace(/\t/g,"");
dfiAmount = dfiAmount.replace(/\n/g,"");
//console.log("DF is " + dfiAmount);
$("#Fees p:nth-of-type(3)").text(dfiAmount);
}
})
});
</script>
<script src="https://form.jotform.com/static/feedback2.js?3.3.REV" type="text/javascript"> var JFL_40737220632144 = new JotformFeedback({ formId: '40737220632144', base: 'https://form.jotform.com/', windowTitle: 'Request a Quote', background: '#B10D13', fontColor: '#FFFFFF', type: 'false', height: 500, width: 700, openOnLoad: false }); </script>
</body>
</html>
I think that maybe it is caused by a TypeError, but do not know how I can fix this. Image linked below. It points me to the first line of the source, which is the HTML Doctype. That doesn't make sense to me.
To create an editable pane in C5 I use the following between div tags so the user can simply use the content editor to add text. This works quite well:
<div class="myWrapper">
<?php
$a = new Area('WelcomeText');
$a->display($c);
?>
</div>
But what do I do when the mark-up is a little complicated? I would like to get user to update the 2 images and respective links themselves. Eg picture: http://i48.tinypic.com/4jma8p.png
What is the easiest way for non-code literate users to do this?
<ul class="Gal_2">
<li class="Frst">
<a href="<?php echo $this->getThemePath(); ?>/Images/TEMP_IMG2.jpg" rel="group">
<img src="<?php echo $this->getThemePath(); ?>/Images/TEMP_IMG2.jpg" width="224" height="150" alt="Island Rab" align="left" />
</a>
</li>
<li>
<a href="<?php echo $this->getThemePath(); ?>/Images/TEMP_IMG1.jpg" rel="group">
<img src="<?php echo $this->getThemePath(); ?>/Images/TEMP_IMG1.jpg" width="224" height="150" alt="Island Rab - Lopar beach" align="right" />
</a>
</li>
</ul>
Thanks in advance...
PC
Create a custom block with the free Designer Content addon: http://www.concrete5.org/marketplace/addons/designer-content
The block you create will have two image fields that link to other pages, and then use "static html" fields to surround the images with your <ul> and <li> tags.
This is actually a perfect use case for Designer Content, so it should be fairly self-explanatory. But if you run into problems, post a message to the support forum (or just email me directly at concrete#jordanlev.com).
Is there a way for me to highlight a menu li depending on the page id? I can't seem to figure out a way to do it.
http://www.dawaf.co.uk/cthm/work/
<div id="header">
<h1>
<a href="http://www.dawaf.co.uk/cthm/work">
<img src="http://www.dawaf.co.uk/cthm/wp-content/uploads/2013/01/logo2.png" alt="CTHM Logo" id="logo" width="140" height="44" />
</a>
<div id="contact-details">
26 Queen Anne Road, London, E9 7AH<br />
t + 44 7912325101<br />
hello#cthm.co.uk
</div>
</h1>
<div id="nav">
<span id="nav-li">
Work
Studio
CTHM+
<a href="https://twitter.com/hello_cthm" target="_blank">
<img src="http://www.dawaf.co.uk/cthm/wp-content/uploads/2013/01/twitter.png" alt="Twitter" width="13" height="13">
</a>
</span>
</div>
</div>
<div id="content">
I would recommend adding an active class to the navigation item. Something like this:
Work
And then the CSS:
#nav a.active {
/* your active style here */
}
You have two options. One is that mentioned by Zak, whereby you would need to use jQuery for your website to mark only one item at a time as "active". The other option is the CSS :active selector, which will auto apply CSS to the link which is in use (at the present time). For example:
#nav li a:active {
/* Insert styling here, such as, background-color: #01B */
}
Let me know if this helps!
I'm trying to limit maintnance headaches by avoiding having to copy and paste code and having to update it on several different sites. Should I use an iframe? So far I just used inline CSS to style it and plan on copying a pasting to 3 or 4 other sites. Kind of like:
<div style="width:165px; height:40px; background: url('http://site1.com/images/DH-sharebar.gif') repeat-x top #333;float:right;margin-top:15px;margin-right:20px;border-radius:5px;border:1px #565656 solid;">
<a href="http://site1.com/" target="_blank" title="site 1">
<img src="http://davidhairabedian.com/davidhairabedian/images/DH-sharebar-icon.png" style="border-radius:0;margin-top:5px;margin-left:10px;">
</a>
<a href="http://site2.org/" target="_blank" title="site 2">
<img src="http://site1.com/images/DH-sharebar-HPM-icon.png" style="border-radius:0;margin-top:5px;margin-left:10px;">
</a>
<a href="http://site3.org/" target="_blank" title="site 3">
<img src="http://site1.com/images/DH-sharbar-EHF.png" style="border-radius:0;margin-top:5px;margin-left:3px;">
</a>
<a href="http://site4.org/" target="_blank" title="site 4">
<img src="http://site1.com/images/DH-sharebar-EHC.png" style="border-radius:0;margin-top:5px;margin-left:10px;">
</a>
</div>
If you don't mind having a slight delay, you could write a light JavaScript that loaded the content into the page via AJAX, much like facebook / many other widgets do.
The benefit that offsets the fact that your links are not part of the page's initial HTML is the fact that you can update the content of all widgets from one place, with no chance that you'll forget one int he future.
Have a look into how Facebook / Google + / Twitter / Everyone else does this.
Edit
Your question got me thinking about how one might do this, so I did it. I've made a working JSFiddle example.
Basically, you paste an empty div and a script tag into your target pages. The script references a file stored on your central server. It creates another script tag in the document, which itself contains a call to a function defined in the first script, which inserts your widget into the specified div on the page.
Pasted into your pages
<div id="placeholder-div"></div>
<script type="text/javascript" src="http://pagesofinterest.net/stack-examples/what-would-be-the-best-way-to-make-a-widget-that-will-link-to-4-different-websit/script.js"></script>
First script content
(function loadContent() {
(function xss_ajax(url) {
var script_id = null;
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('src', 'http://pagesofinterest.net/stack-examples/what-would-be-the-best-way-to-make-a-widget-that-will-link-to-4-different-websit/content.php');
script.setAttribute('id', 'script_id');
script_id = document.getElementById('script_id');
if(script_id){
document.getElementsByTagName('head')[0].removeChild(script_id);
}
// Insert <script> into DOM
document.getElementsByTagName('head')[0].appendChild(script);
})();
})();
function callback(data) {
document.getElementById('placeholder-div').innerHTML = data;
}
Inserted script content:
<?php ob_start(); ?>
<div style="width:165px; height:40px; background: url('http://site1.com/images/DH-sharebar.gif') repeat-x top #333;float:right;margin-top:15px;margin-right:20px;border-radius:5px;border:1px #565656 solid;">
<a href="http://site1.com/" target="_blank" title="site 1">
<img src="http://davidhairabedian.com/davidhairabedian/images/DH-sharebar-icon.png" style="border-radius:0;margin-top:5px;margin-left:10px;"/>
</a>
<a href="http://site2.org/" target="_blank" title="site 2">
<img src="http://site1.com/images/DH-sharebar-HPM-icon.png" style="border-radius:0;margin-top:5px;margin-left:10px;"/>
</a>
<a href="http://site3.org/" target="_blank" title="site 3">
<img src="http://site1.com/images/DH-sharbar-EHF.png" style="border-radius:0;margin-top:5px;margin-left:3px;"/>
</a>
<a href="http://site4.org/" target="_blank" title="site 4">
<img src="http://site1.com/images/DH-sharebar-EHC.png" style="border-radius:0;margin-top:5px;margin-left:10px;"/>
</a>
</div>
<?php $content = json_encode(ob_get_clean());
echo "callback($content);";
And after all this, it occurred to me that you could just use an iframe:
<iframe src="http://pagesofinterest.net/stack-examples/what-would-be-the-best-way-to-make-a-widget-that-will-link-to-4-different-websit/iframe.html"></iframe>
Personally, I would use the JavaScript method, as this would allow me to modify the style of the widget whenever I wanted, without requiring my users to update their pages.
OK, I have set up channel for the client to add projects. The way it works is simple:
I have a category page that displays all of the projects from the chosen category.
I then have a title_permalink page that displays a project, on this page there are 6 most recent related projects that are from that category, each linking to a projects/view page. On this page it displays the project and again, the SAME 6 most recent related projects.
I need to change the 6 recent related projects to be 6 PREVIOUS projects (from the category) dependant on which project has been chosen? For example, I have 20 projects sorted by date entered, I click on number 11 which was entered on Friday at 09:30. I need the view page to display the PREVIOUS 6 projects (by date&time) dependant on which project page you are on.
I have searched high and low but haven't found any help. I'm not asking someone to give me the answer. I just need pointed in the right direction as to the right solution for this.
The code for my project (title_permalink) page is:
<div id="projectView">
{exp:channel:entries channel="project"}
{exp:imgsizer:size src="{project_image}" width="980px" height="450px"}
<img src="{sized}" width="{width}" height="{height}"/>
{/exp:imgsizer:size}
<div id="projectView_overlay"></div>
<div id="projectView_content">
<h3>{title}</h3>
<p class="projectView_floatLeft"><b>Client:</b> {project_client} – <b>Value:</b> £{project_value} – <b>Duration:</b> {project_duration} weeks – <b>Architect:</b> {project_architect}</p>
<p class="projectView_floatRight" style="color:#fff; font-size: 12.5px; font-weight:bold; margin-bottom: 5px;">{categories}<< Back to<br />{category_name}{/categories}</p>
</div>
{/exp:channel:entries}
<br style="clear:both"/>
</div><!--END PROJECT VIEW-->
<ul id="filmStrip">
{exp:channel:entries start_on="{entry_date format="%Y-%m-%d %H:%i"}" channel="project" limit="6" category_group="1" related_categories_mode="yes" custom_fields="yes"}
<li>
{exp:imgsizer:size src="{project_image}" height="68px" width="137px"}
<img src="{sized}" height="{height}" width="{width}" alt=""/>
{/exp:imgsizer:size}
<p class="thumbTitle">{title}</p>
</li>
{/exp:channel:entries}
</ul><!--END FILM STRIP-->
Thanks for any help!
There is a parameter for the channels tag called start_on=[DATE]. I suggest you grab the entry date from the project you want to pull entries before, then use that date in your related entry tag. Note, you are using a variable {exp:channel:entries} to populate another channel:entries tag so it will always pull the projects you want - you are not hardcoding it.
{exp:channel:entries} // This tag gets your single project data
//output your project details here
{exp:channel:entries start_on="{entry_date format="%Y-%m-%d %H:%i"}" channel="project" limit="6" category_group="1" related_categories_mode="yes" custom_fields="yes"} // this tag grabs the last six projects relative to the single project being displayed
{make your links to the projects here}
{/exp:channel:entries}
{/exp:channel:entries}
You need to use the format YYYY-MM-DD HH:MM, as above.
The one flaw in Dan's answer is that he's nesting two channel:entries tags. That can lead to disaster. You need to embed the "related" template. Also, I think you want stop_before, not start_on. Try this modified code:
<div id="projectView">
{exp:channel:entries channel="project"}
{exp:imgsizer:size src="{project_image}" width="980px" height="450px"}
<img src="{sized}" width="{width}" height="{height}"/>
{/exp:imgsizer:size}
<div id="projectView_overlay"></div>
<div id="projectView_content">
<h3>{title}</h3>
<p class="projectView_floatLeft"><b>Client:</b> {project_client} – <b>Value:</b> £{project_value} – <b>Duration:</b> {project_duration} weeks – <b>Architect:</b> {project_architect}</p>
<p class="projectView_floatRight" style="color:#fff; font-size: 12.5px; font-weight:bold; margin-bottom: 5px;">{categories}<< Back to<br />{category_name}{/categories}</p>
</div>
<br style="clear:both"/>
</div><!--END PROJECT VIEW-->
{embed="projects/related" stop_before="{entry_date format="%Y-%m-%d %H:%i"}"}
{/exp:channel:entries}
And projects/related looks like:
{exp:channel:entries channel="project" limit="6" category_group="1" stop_before="{embed:stop_before}" related_categories_mode="yes" custom_fields="yes"}
{if count == "1"}<ul id="filmStrip">{/if}
<li>
{exp:imgsizer:size src="{project_image}" height="68px" width="137px"}
<img src="{sized}" height="{height}" width="{width}" alt=""/>
{/exp:imgsizer:size}
<p class="thumbTitle">{title}</p>
</li>
{if count == total_results}</ul>{/if}
{/exp:channel:entries}