skipwater:
I just needed a fast and easy way to add a popup window. Any where that I could place a link.
Just for easy setup I place this file in includes/templates/YOUR_TEMPLATE/common/popup.php
But you can place it anywhere you want you just have to add the path to the include statment.
Just copy the code below and save it as popup.php
[php]
<?php
/**
* popup.php
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
*
* Standards Compliant Popup Script
* Author : Kevin Cannon
* http://www.multiblah.com
* Last Edited: 12.12.2004
* Version 1.0
*
* SkipWater adapted for zen cart 10.15.09
*
* Searches through a document for links with the class popup.
* When clicked, this link will open in a popup window.
* This means you don't have to add javascript to your code,
* and means the links continue to work, for search engines,
* and browsers without javascript.
*
*/
?>
<script type="text/javascript">
function initPopups() {
if (!document.getElementById) return
var aLinks = document.getElementsByTagName('a');
for (var i = 0; i < aLinks.length; i++) {
if (aLinks[i].className == 'popup') {
aLinks[i].onclick = function() {
var url = this.href;
openPopup(url);
return false;
}
}
}
}
// popupWindow function
// This is where you set your specific height & width etc... for your popups.
function openPopup(url) {
window.open(url, 'popupwindow', 'width=640,height=500,scrollbars,resizable');
return false;
}
// Piggy-back fucntion onto onLoad event
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
addLoadEvent(initPopups);
</script>
[/php]
Add this include link to your includes/templates/YOUR_TEMPLATE/common/html_header.php just before </head> tag.
[php]
<?php include("popup.php"); ?>
[/php]
To call the popup with a link
[php]
<a class="popup" href="path_to_it/pdf_file.pdf">A PDF File or any file you want in the popup window</a>
[/php]
That's it
Skip
Skip. I am very new to this coding thing and I am not getting this right somehow. I followed all instructions and I still can't get it right. One thing I noticed my template do not has a html_header.php file inside of commons so I copied it from another template (maybe that is the problem?) But still here is the code I am adding (this is a sample code I am using to try to get it right) ...For a complete review of the Spanish Verbs<a class="popup"href="download/SpanishVerbsforDummies.pdf"> Click here</a>...
I have my pdf file loaded inside of download, I created the popup.php file and I added the code to the html_header.php
I get a popup window saying ...Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
The url I am working on is
http://halifaxspanishlessons.com/training/index.php?main_page=page&id=5 but it is password protected. let me know please if you can help me with this. thanks..