Affilistore Mod – Bespoke Page Banner
Adds a custom page banner to the top of the page content.
Admin defined banner per page. One banner per page if set.
If right hand columns visible, e.g home page, then these are pushed down by a css controlled value.
Div & CSS controlled. Allows for a seamless header layout without using the editor.
1.MySQL
Run the following sql command:
-
ALTER TABLE `affiliSt_pages`
-
ADD `pageBanner1` BOOL NOT NULL DEFAULT 0,
-
ADD `pageBanner2` TEXT NULL,
-
ADD `pageBanner3` VARCHAR (150 ) NULL;
2. Index.php
Around line 240
Above // add single prod...
add:
-
/**************/
-
/* Banner Mod */
-
/**************/
-
include("includes/bannerhead.inc.php");
-
$body->assign("BANNERHEAD",$box_content);
-
/** End **/
Around new line 282 //home and page contents
Below if (($_GET....
-
/**************/
-
/* Banner Mod */
-
/**************/
-
include("includes/banner.inc.php");
-
$body->assign("PAGEBANNER",$box_content);
-
/** End **/
and below else if...
-
/**************/
-
/* Banner Mod */
-
/**************/
-
include("includes/banner.inc.php");
-
$body->assign("PAGEBANNER",$box_content);
-
/** End **/
3. Style -> Index.tpl
Below
-
div id="sideNavRight"
Add:
-
{BANNERHEAD}
Below
-
div id="content"
ADD
-
{PAGEBANNER}
4. Style -> StyleTemplates
Add file pagebanner.tpl
-
<!-- BEGIN: banner -->
-
<div id="pageBanner">
-
{PAGEBANNER}
-
</div>
-
<!-- END: banner -->
-
<!-- BEGIN: nobanner -->
-
<!-- END: nobanner -->
Add file bannerhead.tpl
-
<!-- BEGIN: banner -->
-
{PGHEAD}
-
<!-- END: banner -->
-
<!-- BEGIN: nobanner -->
-
<!-- END: nobanner -->
5. Includes
Add file banner.inc.php
-
<?php
-
/*
-
+--------------------------------------------------------------------------
-
| AffiliStore 2
-
| ========================================
-
| Web: http://www.affilistore.com
-
| Email: admin (at) affilistore (dot) com
-
| License Type: AffiliStore 2 is NOT open source software and limitations apply
-
| Licence Info: Visit AffiliStore website and click on 'Licence'
-
|
-
| Custom Page Banner Mod
-
| Add a custom banner to the home, news or custom page
-
| Anyname DS
-
| Web: http://www.anyname.co.uk Email: admin@anyname.co.uk
-
+--------------------------------------------------------------------------
-
*/
-
echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
-
exit;
-
}
-
-
//Base Check
-
$nobanner = TRUE;
-
$nobanner = TRUE;
-
} elseif (!$pageDetails['pageBanner1']) {
-
$nobanner = TRUE;
-
} else {
-
$banner_alt = '';
-
$nobanner = FALSE;
-
}
-
-
$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/pagebanner.tpl");
-
-
//check banner being used
-
if ($nobanner) {
-
$box_content->parse("nobanner");
-
$box_content = $box_content->text("nobanner");
-
} else {
-
$banner_alt = $pageSubDetails['pageBanner3'];
-
$box_content->assign("PAGEBANNER",'<img src="'.$pageSubDetails['pageBanner2'].'" alt="'.$pageSubDetails['pageBanner3'].'">');
-
} else {
-
$banner_alt = $pageDetails['pageBanner3'];
-
$box_content->assign("PAGEBANNER",'<img src="'.$pageDetails['pageBanner2'].'" alt="'.$pageDetails['pageBanner3'].'">');
-
}
-
$box_content->parse("banner");
-
$box_content = $box_content->text("banner");
-
}
-
?>
Add file bannerhead.inc.php
-
<?php
-
/*
-
+--------------------------------------------------------------------------
-
| AffiliStore 2
-
| ========================================
-
| Web: http://www.affilistore.com
-
| Email: admin (at) affilistore (dot) com
-
| License Type: AffiliStore 2 is NOT open source software and limitations apply
-
| Licence Info: Visit AffiliStore website and click on 'Licence'
-
|
-
| Custom Page Banner Mod
-
| Add a custom banner to the home, news or custom page
-
| Anyname DS
-
| Web: http://www.anyname.co.uk Email: admin@anyname.co.uk
-
+--------------------------------------------------------------------------
-
*/
-
echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
-
exit;
-
}
-
-
//Base Check
-
$banner = TRUE;
-
$nobanner = TRUE;
-
} elseif (!$pageDetails['pageBanner1']) {
-
$nobanner = TRUE;
-
} else {
-
$banner_alt = '';
-
$nobanner = FALSE;
-
}
-
-
$box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/bannerhead.tpl");
-
-
//check banner being used
-
if ($nobanner) {
-
$box_content->parse("nobanner");
-
$box_content = $box_content->text("nobanner");
-
} else {
-
$box_content->assign("PGHEAD",'<div id="pgHead"><ul><li> </li></ul></div>');
-
$box_content->parse("banner");
-
$box_content = $box_content->text("banner");
-
}
-
?>
6. Admin/includes
Replace pd.inc.php with:
-
<?php
-
/*
-
+--------------------------------------------------------------------------
-
| AffiliStore 2
-
| ========================================
-
| Web: http://www.affilistore.com
-
| Email: admin (at) affilistore (dot) com
-
| License Type: AffiliStore 2 is NOT open source software and limitations apply
-
| Licence Info: Visit AffiliStore website and click on 'Licence'
-
+--------------------------------------------------------------------------
-
*/
-
// checks to see if password session is set
-
// if not redirects to ../admin/
-
include('../includes/auth.inc.php');
-
}
-
-
-
// include fck wysiwyg editor
-
include("includes/rte/fckeditor.php");
-
-
// add a category
-
-
// check to see if details have been completed
-
$error = 1;
-
-
// insert new page
-
} else {
-
-
$sql = sprintf("INSERT INTO affiliSt_pages (name, parent, content, location) values (%s, %s, %s, %s)",
-
quote_smart($_POST['addThisPage']),
-
quote_smart($_POST['parentPage']),
-
quote_smart($_POST['addContent']),
-
quote_smart($_POST['linklocation1'].':'.$_POST['linklocation2'].':'.$_POST['linklocation3']));
-
-
/**************/
-
/* BANNER MOD */
-
/**************/
-
//get last id
-
/*** END MOD **/
-
-
// add one to parent subCategories counter
-
if ($_POST['parentPage'] != 'noparent') {
-
quote_smart($_POST['parentPage']));
-
}
-
-
/****************/
-
/** BANNER MOD **/
-
/****************/
-
//get last id
-
// if banner set then add banner info, otherwise db deals with defaults
-
if ($_POST['pageBanner'] == 'usebanner') {
-
-
// move file to folder on server
-
if ($_FILES['pageBannerImg']) {
-
$error = 1;
-
} else {
-
$pgSource = $_FILES['pageBannerImg']['tmp_name'];
-
$pgTarget = "../userfiles/".$_FILES['pageBannerImg']['name'];
-
if ($pgSource != NULL) {
-
-
quote_smart($installDir['value'].'userfiles/'.$_FILES['pageBannerImg']['name']),
-
$thisID);
-
} else {
-
$error = 1;
-
}
-
}
-
} else {
-
$error = 1;
-
}
-
//add image alt tag if set
-
quote_smart($_POST['pageBannerAlt']),
-
$thisID);
-
}
-
}
-
}
-
}
-
-
// delete a category
-
quote_smart($_GET['delete']));
-
-
// subtract one from parent subCategories counter
-
quote_smart($_GET['p']));
-
}
-
}
-
-
// edit a page
-
-
// check to see if details have been completed
-
$error = 1;
-
-
// edit page
-
} else {
-
-
$sql = sprintf("UPDATE affiliSt_pages SET name = %s, parent = %s, content = %s, location = %s WHERE id = %s",
-
quote_smart($_POST['editThisPage']),
-
quote_smart($_POST['parentPage']),
-
quote_smart($_POST['editContent']),
-
quote_smart($_POST['linklocation1'].':'.$_POST['linklocation2'].':'.$_POST['linklocation3']),
-
quote_smart($_POST['editID']));
-
-
if ($_POST['parentPage'] != 'noparent' && $_POST['parentPage'] != $_POST['oldParent']) {
-
-
// add new
-
quote_smart($_POST['parentPage']));
-
-
// minus old
-
quote_smart($_POST['oldParent']));
-
-
} else if ($_POST['parentPage'] == 'noparent') {
-
-
// minus old
-
quote_smart($_POST['oldParent']));
-
-
}
-
-
/***************/
-
/** BANNER MOD */
-
/***************/
-
//add new
-
if ($_POST['pageBanner'] == 'usebanner' ) {
-
-
//remove old links
-
if ($_POST['pageBannerUsed'] == 'usebanner') {
-
quote_smart($_POST['editID']));
-
}
-
//add new & reset used status
-
quote_smart($_POST['editID']));
-
// move file to folder on server
-
if ($_FILES['pageBannerImg']) {
-
$error = 1;
-
} else {
-
$pgSource = $_FILES['pageBannerImg']['tmp_name'];
-
$pgTarget = "../userfiles/".$_FILES['pageBannerImg']['name'];
-
if ($pgSource != NULL) {
-
-
quote_smart($installDir['value'].'userfiles/'.$_FILES['pageBannerImg']['name']),
-
quote_smart($_POST['editID']));
-
} else {
-
$error = 1;
-
}
-
}
-
} else {
-
$error = 1;
-
-
}
-
//add image alt tag if set
-
quote_smart($_POST['pageBannerAlt']),
-
quote_smart($_POST['editID']));
-
}
-
} else {
-
//reset status whatever
-
quote_smart($_POST['editID']));
-
//reset defaults
-
if ($_POST['pageBanner'] == 'nobanner' || $_POST['pageBannerUsed'] == 0) {
-
quote_smart($_POST['editID']));
-
}
-
}
-
/** END MOD **/
-
}
-
}
-
-
-
?>
-
-
<?php
-
// error report
-
if ($error == 1) {
-
echo '<fieldset><strong style="color:red">ERROR: Fields must not be empty</strong></fieldset>';
-
} else {
-
// category added report
-
echo '<fieldset><strong style="color:green">Page Added</strong></fieldset>';
-
}
-
-
// category edited report
-
echo '<fieldset><strong style="color:green">Page Edited</strong></fieldset>';
-
}
-
}
-
-
?>
-
-
-
<?php
-
// edit category html
-
-
quote_smart($_GET['edit']));
-
-
/****************/
-
/** BANNER MOD **/
-
/****************/
-
if ($editCat['pageBanner1']) {
-
$pageBannerUsed = 1;
-
} else {
-
$pageBannerUsed = 0;
-
}
-
/** END **/
-
-
// get link location options
-
?>
-
-
<fieldset style="border: 1px solid green;">
-
<legend>Edit Page</legend>
-
<form enctype="multipart/form-data" action="index.php?ad=pd" method="post" name="editDetails">
-
<table cellpadding="4" cellspacing="0" border="0" width="100%">
-
<tr>
-
<td valign="top" align="left">
-
<label for="edit_page">Page Name/Title: </label>
-
</td>
-
<td valign="top" align="left">
-
<input name="editThisPage" type="text" class="adminInput" id="edit_page" <?php if ($_GET['edit'] == 1) { echo 'disabled="disabled" value="Use editor below to create home title"'; } else { ?> value="<?php echo $editCat['name'] ?>" <?php } ?> />
-
</td>
-
</tr>
-
<tr>
-
<td valign="top" align="left">
-
<label for="parent_page">Parent Page: </label>
-
</td>
-
<td valign="top" align="left">
-
<select name="parentPage" id="parent_page" />
-
<option value="noparent">No Parent</option>
-
<?php
-
// repeat cat names options
-
do {
-
if (($catNames['id'] !== NULL && $catNames['parent'] == 0 && $editCat['subCategories'] == 0 && $editCat['id'] != $catNames['id'] && $catNames['id'] != 1) && $_GET['edit'] != 1) { ?>
-
<option value="<?php echo $catNames['id'] ?>"
-
<?php if ($editCat['parent'] == $catNames['id']) {
-
echo ' selected="selected" ';
-
}
-
?>
-
>
-
<?php }
-
</select>
-
</td>
-
</tr>
-
<?php if ($_GET['edit'] != 1) { ?>
-
<tr>
-
<td valign="top" align="left">
-
</td>
-
<td valign="top" align="left">
-
<input name="linklocation1" id="link_location" type="checkbox" value="1" <? if ($linkOpt[0] == 1) { echo 'checked="checked"'; } ?> /> Top Navigation<br />
-
<input name="linklocation2" type="checkbox" value="1" <? if ($linkOpt[1] == 1) { echo 'checked="checked"'; } ?> /> Side Navigation<br />
-
<input name="linklocation3" type="checkbox" value="1" <? if ($linkOpt[2] == 1) { echo 'checked="checked"'; } ?> /> Footer Links<br />
-
</td>
-
</tr>
-
<?php } ?>
-
<!-- BANNER MOD -->
-
<td valign="top" align="left">
-
<label for="page_banner">Page Banner: </label>
-
</td>
-
<td valign="top" align="left">
-
<select name="pageBanner" id="page_banner" />
-
<option value="nobanner" selected="selected">No Banner</option>
-
<option value="usebanner">Use Banner</option>
-
</select>
-
</td>
-
</tr>
-
<tr>
-
<td valign="top" align="left">
-
<label for="page_banner_img">Page Banner Image: </label>
-
</td>
-
<td>
-
<input type="file" name="pageBannerImg" id="page_banner_img" value="<?php echo $editCat['pageBanner2'];?>" />
-
</td>
-
</tr>
-
<?php
-
$imagefileloc = $editCat['pageBanner2'];
-
?>
-
<tr>
-
<td valign="top" align="left">
-
<label for="page_banner_alt">Page Banner Alt: </label>
-
</td>
-
<td>
-
<input name="pageBannerAlt" type="text" id="page_banner_alt" class="adminInput" value="<?php echo $editCat['pageBanner3']; ?>" /><br />
-
</td>
-
</tr>
-
<tr>
-
<td valign="top" align="left" colspan="2">
-
<?php
-
if ($imagefileloc != NULL) {
-
}
-
?>
-
</td>
-
</tr>
-
<!-- END -->
-
<tr>
-
<td valign="top" align="left" colspan="2">
-
<?php
-
$oFCKeditor = new FCKeditor('editContent');
-
$oFCKeditor->BasePath = 'includes/rte/';
-
$oFCKeditor->Value = $editCat['content'];
-
$oFCKeditor->Create();
-
?>
-
</td>
-
</tr>
-
</table>
-
<input type="hidden" name="editID" value="<?php echo $_GET['edit']; ?>" />
-
<input type="hidden" name="oldParent" value="<?php echo $_GET['p']; ?>" />
-
<input type="hidden" name="pd_edited" value="yes" />
-
<!-- BANER MOD -->
-
<input type="hidden" name="pageBannerUsed" value="<?php echo $pageBannerUsed; ?>" />
-
<!-- END -->
-
<input value="Edit Page" type="submit" class="padSubmit" />
-
</form>
-
</fieldset>
-
-
<?php } else {
-
// add page html
-
?>
-
-
-
<fieldset>
-
<legend>Add Page</legend>
-
<form enctype="multipart/form-data" action="index.php?ad=pd" method="post" name="updateDetails">
-
<table cellpadding="4" cellspacing="0" border="0" width="100%">
-
<tr>
-
<td valign="top" align="left">
-
<label for="add_page">Page Name/Title: </label>
-
</td>
-
<td valign="top" align="left">
-
<input name="addThisPage" type="text" class="adminInput" id="add_page" />
-
</td>
-
</tr>
-
<tr>
-
<td valign="top" align="left">
-
<label for="parent_page">Parent Page: </label>
-
</td>
-
<td valign="top" align="left">
-
<select name="parentPage" id="parent_page" />
-
<option value="noparent" selected="selected">No Parent</option>
-
<?php
-
// repeat cat names options
-
do {
-
if ($catNames['id'] !== NULL && $catNames['parent'] == 0 && $catNames['id'] != 1) { ?>
-
<?php }
-
</select>
-
</td>
-
</tr>
-
<tr>
-
<td valign="top" align="left">
-
</td>
-
<td valign="top" align="left">
-
<input name="linklocation1" id="link_location" type="checkbox" value="1" /> Top Navigation<br />
-
<input name="linklocation2" type="checkbox" value="1" checked="checked" /> Side Navigation<br />
-
<input name="linklocation3" type="checkbox" value="1" /> Footer Links<br />
-
</td>
-
</tr>
-
-
<!-- BANNER MOD -->
-
<tr>
-
<td valign="top" align="left">
-
<label for="page_banner">Page Banner: </label>
-
</td>
-
<td valign="top" align="left">
-
<select name="pageBanner" id="page_banner" />
-
<option value="nobanner" selected="selected">No Banner</option>
-
<option value="usebanner">Use Banner</option>
-
</select>
-
</td>
-
</tr>
-
<tr>
-
<td valign="top" align="left">
-
<label for="page_banner_img">Page Banner Image: </label>
-
</td>
-
<td>
-
<input type="file" name="pageBannerImg" id="page_banner_img" value="<?php echo $catNames['pageBanner2'];?>" />
-
</td>
-
</tr>
-
<?php
-
$imagefileloc = $catNames['pageBanner2'];
-
?>
-
<tr>
-
<td valign="top" align="left">
-
<label for="page_banner_alt">Page Banner Alt: </label>
-
</td>
-
<td>
-
<input name="pageBannerAlt" type="text" id="page_banner_alt" class="adminInput" value="<?php echo $catNames['pageBanner3']; ?>" /><br />
-
</td>
-
</tr>
-
<tr>
-
<td valign="top" align="left" colspan="2">
-
<?php
-
if ($imagefileloc != NULL) {
-
}
-
?>
-
</td>
-
</tr>
-
<!-- END -->
-
<tr>
-
<td valign="top" align="left" colspan="2">
-
<?php
-
$oFCKeditor = new FCKeditor('addContent');
-
$oFCKeditor->BasePath = 'includes/rte/';
-
$oFCKeditor->Value = "";
-
$oFCKeditor->Create();
-
?>
-
</td>
-
</tr>
-
</table>
-
<input type="hidden" name="pd_updated" value="yes" />
-
<input type="hidden" value="pageBannerUsed" value="0">
-
<input value="Add Page" type="submit" class="padSubmit" />
-
</form>
-
</fieldset>
-
-
<?php } ?>
-
-
<fieldset>
-
<legend>Current Pages</legend>
-
-
<strong>Home</strong> [<a href="index.php?ad=pd&edit=1">edit</a>]<br />
-
-
<?php
-
// repeat category listings
-
do {
-
if ($topCat['id'] !== NULL && $topCat['parent'] == 0 && $topCat['id'] != 1) {
-
[<a href="index.php?ad=pd&edit='.$topCat['id'].'">edit</a>] ';
-
-
// delete if category has no links
-
if ($topCat['counter'] == 0 && $topCat['subCategories'] == 0) {
-
} else {
-
echo '[<span style="color:grey">delete</span>]<br />';
-
}
-
-
-
// repeat sub category listings
-
do {
-
-
if ($subCat['parent'] == $topCat['id']) {
-
[<a href="index.php?ad=pd&edit='.$subCat['id'].'&p='.$subCat['parent'].'">edit</a>] ';
-
-
// delete if category has no links
-
if ($subCat['counter'] == 0) {
-
echo '[<a href="index.php?ad=pd&delete='.$subCat['id'].'&p='.$subCat['parent'].'">delete</a>]<br />';
-
} else {
-
echo '[<span style="color:grey">delete</span>]<br />';
-
}
-
}
-
}
-
</fieldset>
7. Admin/css
Modify admin.css #pageSurround fieldset {}
width: 738px -> width:798px;
8. Style -> StyleSheet
add to style.css:
-
/**************/
-
/* Banner Mod */
-
/**************/
-
#pageBanner {
-
position: relative;
-
float:left;
-
margin: 0;
-
padding: 0;
-
width: 740px;
-
max-height: 200px;
-
clear: both;
-
}
-
#pgHead {
-
position: relative;
-
float: left;
-
width: 300px;
-
height: 0px
-
margin: 0;
-
padding: 0px;
-
}
-
#pgHead ul {
-
float:left;
-
}
-
#pgHead ul li {
-
list-style: none;
-
display: block;
-
width: 300px;
-
height: 0;
-
margin: 175px 0 0 0;
-
background-color: transparent;
-
padding: 0;
-
}
-
/** End */
Backup files as you go!!
Can be seen at http://www.iwatches.co.uk
... support my developments, buy a watch!!




