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:

SQL:
  1. ALTER TABLE `affiliSt_pages`
  2. ADD `pageBanner1` BOOL NOT NULL DEFAULT 0,
  3. ADD `pageBanner2` TEXT NULL,
  4. ADD `pageBanner3` VARCHAR (150 ) NULL;

2. Index.php
Around line 240
Above // add single prod...
add:

PHP:
  1. /**************/
  2.     /* Banner Mod */
  3.     /**************/
  4.     include("includes/bannerhead.inc.php");
  5.     $body->assign("BANNERHEAD",$box_content);
  6.     /** End **/

Around new line 282 //home and page contents
Below if (($_GET....

PHP:
  1. /**************/
  2.     /* Banner Mod */
  3.     /**************/
  4.     include("includes/banner.inc.php");
  5.     $body->assign("PAGEBANNER",$box_content);
  6.     /** End **/

and below else if...

PHP:
  1. /**************/
  2.     /* Banner Mod */
  3.     /**************/
  4.     include("includes/banner.inc.php");
  5.     $body->assign("PAGEBANNER",$box_content);
  6.     /** End **/

3. Style -> Index.tpl

Below

CODE:
  1. div id="sideNavRight"

Add:

HTML:
  1. {BANNERHEAD}

Below

CODE:
  1. div id="content"

ADD

HTML:
  1. {PAGEBANNER}

4. Style -> StyleTemplates
Add file pagebanner.tpl

HTML:
  1. <!-- BEGIN: banner -->
  2. <div id="pageBanner">
  3. {PAGEBANNER}
  4. </div>
  5. <!-- END: banner -->
  6. <!-- BEGIN: nobanner -->
  7. <!-- END: nobanner -->

Add file bannerhead.tpl

HTML:
  1. <!-- BEGIN: banner -->
  2. {PGHEAD}
  3. <!-- END: banner -->
  4. <!-- BEGIN: nobanner -->
  5. <!-- END: nobanner -->

5. Includes
Add file banner.inc.php

PHP:
  1. <?php
  2. /*
  3. +--------------------------------------------------------------------------
  4. |   AffiliStore 2
  5. |   ========================================
  6. |   Web: http://www.affilistore.com
  7. |   Email: admin (at) affilistore (dot) com
  8. |   License Type: AffiliStore 2 is NOT open source software and limitations apply
  9. |   Licence Info: Visit AffiliStore website and click on 'Licence'
  10. |
  11. |   Custom Page Banner Mod
  12. |   Add a custom banner to the home, news or custom page
  13. |   Anyname DS
  14. |   Web: http://www.anyname.co.uk Email: admin@anyname.co.uk
  15. +--------------------------------------------------------------------------
  16. */
  17. if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
  18.     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>";
  19.     exit;
  20. }
  21.  
  22. //Base Check
  23. if (isset($_GET['subpage']) && (!$pageSubDetails['pageBanner1'])) {
  24.     $nobanner = TRUE;
  25. } elseif (isset($_GET['page']) && (!$pageDetails['pageBanner1'])) {
  26.     $nobanner = TRUE;
  27. } elseif (!$pageDetails['pageBanner1']) {
  28.     $nobanner = TRUE;
  29. } else {
  30.     $banner_alt = '';
  31.     $nobanner = FALSE;
  32. }
  33.  
  34. $box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/pagebanner.tpl");
  35.            
  36.     //check banner being used
  37.     if ($nobanner) {
  38.         $box_content->parse("nobanner");
  39.         $box_content = $box_content->text("nobanner");
  40.     } else {
  41.         if (isset($_GET['subpage'])) {
  42.             $banner_alt = $pageSubDetails['pageBanner3'];
  43.             $box_content->assign("PAGEBANNER",'<img src="'.$pageSubDetails['pageBanner2'].'" alt="'.$pageSubDetails['pageBanner3'].'">');
  44.         } else {
  45.             $banner_alt = $pageDetails['pageBanner3'];
  46.             $box_content->assign("PAGEBANNER",'<img src="'.$pageDetails['pageBanner2'].'" alt="'.$pageDetails['pageBanner3'].'">');   
  47.         }
  48.         $box_content->parse("banner");
  49.         $box_content = $box_content->text("banner");
  50.     }
  51. ?>

Add file bannerhead.inc.php

PHP:
  1. <?php
  2. /*
  3. +--------------------------------------------------------------------------
  4. |   AffiliStore 2
  5. |   ========================================
  6. |   Web: http://www.affilistore.com
  7. |   Email: admin (at) affilistore (dot) com
  8. |   License Type: AffiliStore 2 is NOT open source software and limitations apply
  9. |   Licence Info: Visit AffiliStore website and click on 'Licence'
  10. |
  11. |   Custom Page Banner Mod
  12. |   Add a custom banner to the home, news or custom page
  13. |   Anyname DS
  14. |   Web: http://www.anyname.co.uk Email: admin@anyname.co.uk
  15. +--------------------------------------------------------------------------
  16. */
  17. if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {
  18.     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>";
  19.     exit;
  20. }
  21.  
  22. //Base Check
  23. if (isset($_GET['subpage']) && (!$pageSubDetails['pageBanner1'])) {
  24.     $banner = TRUE;
  25. } elseif (isset($_GET['page']) && (!$pageDetails['pageBanner1'])) {
  26.     $nobanner = TRUE;
  27. } elseif (!$pageDetails['pageBanner1']) {
  28.     $nobanner = TRUE;
  29. } else {
  30.     $banner_alt = '';
  31.     $nobanner = FALSE;
  32. }
  33.  
  34. $box_content = new XTemplate ("skins/".$configSkin['value']."/styleTemplates/bannerhead.tpl");
  35.            
  36.     //check banner being used
  37.     if ($nobanner) {
  38.         $box_content->parse("nobanner");
  39.         $box_content = $box_content->text("nobanner");
  40.     } else {
  41.         $box_content->assign("PGHEAD",'<div id="pgHead"><ul><li>&nbsp;</li></ul></div>');
  42.         $box_content->parse("banner");
  43.         $box_content = $box_content->text("banner");
  44.     }
  45. ?>

6. Admin/includes

Replace pd.inc.php with:

PHP:
  1. <?php
  2. /*
  3. +--------------------------------------------------------------------------
  4. |   AffiliStore 2
  5. |   ========================================
  6. |   Web: http://www.affilistore.com
  7. |   Email: admin (at) affilistore (dot) com
  8. |   License Type: AffiliStore 2 is NOT open source software and limitations apply
  9. |   Licence Info: Visit AffiliStore website and click on 'Licence'
  10. +--------------------------------------------------------------------------
  11. */
  12. // checks to see if password session is set
  13. // if not redirects to ../admin/
  14. if($_SESSION['loggedIn'] == 0 && !isset($adminPage)){
  15. include('../includes/auth.inc.php');
  16. }
  17.  
  18.  
  19. // include fck wysiwyg editor
  20. include("includes/rte/fckeditor.php");
  21.  
  22. // add a category
  23. if (isset($_POST['pd_updated'])) {
  24.  
  25.     // check to see if details have been completed
  26.     if (empty($_POST['addThisPage'])) {
  27.     $error = 1;
  28.  
  29.     // insert new page
  30.     } else {
  31.  
  32.         $sqlsprintf("INSERT INTO affiliSt_pages (name, parent, content, location) values (%s, %s, %s, %s)",
  33.                quote_smart($_POST['addThisPage']),
  34.                quote_smart($_POST['parentPage']),
  35.                quote_smart($_POST['addContent']),
  36.                quote_smart($_POST['linklocation1'].':'.$_POST['linklocation2'].':'.$_POST['linklocation3']));
  37.         mysql_query($sql, $databaseConnect) or die(mysql_error());
  38.        
  39.         /**************/
  40.         /* BANNER MOD */
  41.         /**************/
  42.         //get last id
  43.         $thisID = mysql_insert_id();
  44.         /*** END MOD **/
  45.  
  46.         // add one to parent subCategories counter
  47.         if ($_POST['parentPage'] != 'noparent') {
  48.         $sqlsprintf("UPDATE affiliSt_pages SET subCategories = subCategories + 1 WHERE id = %s",
  49.                    quote_smart($_POST['parentPage']));
  50.         mysql_query($sql, $databaseConnect) or die(mysql_error());
  51.         }
  52.  
  53.         /****************/
  54.         /** BANNER MOD **/
  55.         /****************/
  56.         //get last id
  57.         $thisID = mysql_insert_id();
  58.         // if banner set then add banner info, otherwise db deals with defaults
  59.         if ($_POST['pageBanner'] == 'usebanner') {
  60.             $sql = sprintf("UPDATE affiliSt_pages SET pageBanner1 = 1 WHERE id = %s", $thisID);
  61.             mysql_query($sql, $databaseConnect) or die(mysql_error());
  62.    
  63.             // move file to folder on server
  64.             if ($_FILES['pageBannerImg']) {
  65.                 if (empty($_FILES['pageBannerImg']['name'])) {
  66.                     $error = 1;
  67.                 } else {
  68.                     $pgSource = $_FILES['pageBannerImg']['tmp_name'];
  69.                     $pgTarget = "../userfiles/".$_FILES['pageBannerImg']['name'];
  70.                     if ($pgSource != NULL) {
  71.                         move_uploaded_file($pgSource, $pgTarget) or die ("couldn't copy image");
  72.        
  73.                         $sql = sprintf("UPDATE affiliSt_pages SET pageBanner2 = %s WHERE id = %s",
  74.                             quote_smart($installDir['value'].'userfiles/'.$_FILES['pageBannerImg']['name']),
  75.                             $thisID);
  76.                         mysql_query($sql, $databaseConnect) or die(mysql_error());
  77.                     } else {
  78.                         $error = 1;
  79.                     }
  80.                 }
  81.             } else {
  82.                 $error = 1;
  83.             }
  84.             //add image alt tag if set
  85.             if ($_POST['pageBannerAlt'] && (!empty($_POST['pageBannerAlt']))) {
  86.                 $sql = sprintf("UPDATE affiliSt_pages SET pageBanner3 = %s WHERE id = %s",
  87.                         quote_smart($_POST['pageBannerAlt']),
  88.                         $thisID);
  89.                 mysql_query($sql, $databaseConnect) or die(mysql_error());
  90.             }
  91.         }
  92.     }
  93. }
  94.  
  95. // delete a category
  96. if (isset($_GET['delete'])) {
  97. $sqlsprintf("DELETE FROM affiliSt_pages WHERE id = %s",
  98.            quote_smart($_GET['delete']));
  99. mysql_query($sql, $databaseConnect) or die(mysql_error());
  100.  
  101.     // subtract one from parent subCategories counter
  102.     if (isset($_GET['p'])) {
  103.     $sqlsprintf("UPDATE affiliSt_pages SET subCategories = subCategories - 1 WHERE id = %s",
  104.                 quote_smart($_GET['p']));
  105.     mysql_query($sql, $databaseConnect) or die(mysql_error());
  106.     }
  107. }
  108.  
  109. // edit a page
  110. if (isset($_POST['pd_edited'])) {
  111.  
  112.     // check to see if details have been completed
  113.     if (empty($_POST['editThisPage']) && $_POST['editID'] != 1) {
  114.         $error = 1;
  115.    
  116.     // edit page
  117.     } else {
  118.    
  119.         $sqlsprintf("UPDATE affiliSt_pages SET name = %s, parent = %s, content = %s, location = %s WHERE id = %s",
  120.                quote_smart($_POST['editThisPage']),
  121.                quote_smart($_POST['parentPage']),
  122.                quote_smart($_POST['editContent']),
  123.                quote_smart($_POST['linklocation1'].':'.$_POST['linklocation2'].':'.$_POST['linklocation3']),
  124.                quote_smart($_POST['editID']));
  125.         mysql_query($sql, $databaseConnect) or die(mysql_error());
  126.            
  127.         if ($_POST['parentPage'] != 'noparent' && $_POST['parentPage'] != $_POST['oldParent']) {
  128.        
  129.             // add new
  130.             $sqlsprintf("UPDATE affiliSt_pages SET subCategories = subCategories + 1 WHERE id = %s",
  131.                     quote_smart($_POST['parentPage']));
  132.             mysql_query($sql, $databaseConnect) or die(mysql_error());
  133.        
  134.             // minus old
  135.             $sqlsprintf("UPDATE affiliSt_pages SET subCategories = subCategories - 1 WHERE id = %s",
  136.                     quote_smart($_POST['oldParent']));
  137.             mysql_query($sql, $databaseConnect) or die(mysql_error());
  138.        
  139.         } else if  ($_POST['parentPage'] == 'noparent') {
  140.        
  141.             // minus old
  142.             $sqlsprintf("UPDATE affiliSt_pages SET subCategories = subCategories - 1 WHERE id = %s",
  143.                     quote_smart($_POST['oldParent']));
  144.             mysql_query($sql, $databaseConnect) or die(mysql_error());
  145.        
  146.         }
  147.        
  148.         /***************/
  149.         /** BANNER MOD */
  150.         /***************/
  151.         //add new
  152.         if ($_POST['pageBanner'] == 'usebanner' ) {
  153.            
  154.             //remove old links
  155.             if ($_POST['pageBannerUsed'] == 'usebanner') {
  156.                 $sql = sprintf("UPDATE affiliSt_pages SET pageBanner2 = NULL, pageBanner3 = NULL WHERE id = %s",
  157.                         quote_smart($_POST['editID']));
  158.                 mysql_query($sql, $databaseConnect) or die($mysql_error());
  159.             }
  160.             //add new & reset used status
  161.             $sql = sprintf("UPDATE affiliSt_pages SET pageBanner1 = 1 WHERE id = %s",
  162.                 quote_smart($_POST['editID']));
  163.             mysql_query($sql, $databaseConnect) or die(mysql_error());
  164.             // move file to folder on server
  165.             if ($_FILES['pageBannerImg']) {
  166.                 if (empty($_FILES['pageBannerImg']['name'])) {
  167.                     $error = 1;
  168.                 } else {
  169.                     $pgSource = $_FILES['pageBannerImg']['tmp_name'];
  170.                     $pgTarget = "../userfiles/".$_FILES['pageBannerImg']['name'];
  171.                     if ($pgSource != NULL) {
  172.                         move_uploaded_file($pgSource, $pgTarget) or die ("couldn't copy image");
  173.        
  174.                         $sql = sprintf("UPDATE affiliSt_pages SET pageBanner2 = %s WHERE id = %s",
  175.                             quote_smart($installDir['value'].'userfiles/'.$_FILES['pageBannerImg']['name']),
  176.                             quote_smart($_POST['editID']));
  177.                         mysql_query($sql, $databaseConnect) or die(mysql_error());
  178.                     } else {
  179.                         $error = 1;
  180.                     }
  181.                 }
  182.             } else {
  183.                 $error = 1;
  184.  
  185.             }
  186.             //add image alt tag if set
  187.             if ($_POST['pageBannerAlt'] && !empty($_POST['pageBannerAlt'])) {
  188.                 $sql = sprintf("UPDATE affiliSt_pages SET pageBanner3 = %s WHERE id = %s",
  189.                     quote_smart($_POST['pageBannerAlt']),
  190.                     quote_smart($_POST['editID']));
  191.                 mysql_query($sql, $databaseConnect) or die(mysql_error());
  192.             }
  193.         } else {
  194.             //reset status whatever
  195.             $sql = sprintf("UPDATE affiliSt_pages SET pageBanner1 = 0 WHERE id = %s",
  196.                 quote_smart($_POST['editID']));
  197.             mysql_query($sql, $databaseConnect) or die(mysql_error());
  198.             //reset defaults
  199.             if ($_POST['pageBanner'] == 'nobanner' || $_POST['pageBannerUsed'] == 0) {
  200.                 $sql = sprintf("UPDATE affiliSt_pages SET pageBanner2 = NULL, pageBanner3 = NULL WHERE id = %s",
  201.                     quote_smart($_POST['editID']));
  202.                 mysql_query($sql, $databaseConnect) or die(mysql_error());
  203.             }
  204.         }
  205.         /** END MOD **/
  206.     }
  207. }
  208.  
  209. $getCatNames = mysql_query("SELECT * FROM affiliSt_pages ORDER BY name ASC");
  210. $catNames = mysql_fetch_assoc($getCatNames);
  211.  
  212. $getTopCat = mysql_query("SELECT * FROM affiliSt_pages ORDER BY name ASC");
  213. $topCat = mysql_fetch_assoc($getTopCat);
  214. ?>
  215.  
  216. <?php
  217. // error report
  218. if ($error == 1) {
  219. echo '<fieldset><strong style="color:red">ERROR: Fields must not be empty</strong></fieldset>';
  220. } else {
  221.     // category added report
  222.     if (isset($_POST['pd_updated'])) {
  223.     echo '<fieldset><strong style="color:green">Page Added</strong></fieldset>';
  224.     }
  225.    
  226.     // category edited report
  227.     if (isset($_POST['pd_edited'])) {
  228.     echo '<fieldset><strong style="color:green">Page Edited</strong></fieldset>';
  229.     }
  230. }
  231.  
  232. ?>
  233.  
  234.  
  235. <?php
  236. // edit category html
  237. if (isset($_GET['edit'])) {
  238.  
  239. $sqlsprintf("SELECT * FROM affiliSt_pages WHERE id = %s",
  240.            quote_smart($_GET['edit']));
  241. $getEditCat = mysql_query($sql, $databaseConnect) or die(mysql_error());
  242. $editCat = mysql_fetch_assoc($getEditCat);
  243.  
  244. /****************/
  245. /** BANNER MOD **/
  246. /****************/
  247. if ($editCat['pageBanner1']) {
  248.     $pageBannerUsed = 1;
  249. } else {
  250.     $pageBannerUsed = 0;
  251. }
  252. /** END **/
  253.  
  254. // get link location options
  255. $linkOpt = explode(":", $editCat['location']);
  256. ?>
  257.  
  258. <fieldset style="border: 1px solid green;">
  259. <legend>Edit Page</legend>
  260. <form enctype="multipart/form-data" action="index.php?ad=pd" method="post" name="editDetails">
  261. <table cellpadding="4" cellspacing="0" border="0" width="100%">
  262. <tr>
  263. <td valign="top" align="left">
  264. <label for="edit_page">Page Name/Title: </label>
  265. </td>
  266. <td valign="top" align="left">
  267. <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 } ?> />
  268. </td>
  269. </tr>
  270. <tr>
  271. <td valign="top" align="left">
  272. <label for="parent_page">Parent Page: </label>
  273. </td>
  274. <td valign="top" align="left">
  275. <select name="parentPage" id="parent_page" />
  276. <option value="noparent">No Parent</option>
  277. <?php
  278. // repeat cat names options
  279. do {
  280.         if (($catNames['id'] !== NULL && $catNames['parent'] == 0 && $editCat['subCategories'] == 0 && $editCat['id'] != $catNames['id'] && $catNames['id'] != 1) && $_GET['edit'] != 1) { ?>
  281.         <option value="<?php echo $catNames['id'] ?>"
  282.         <?php if ($editCat['parent'] == $catNames['id']) {
  283.         echo ' selected="selected" ';
  284.             }
  285. ?>
  286. >
  287. <?php echo $catNames['name'] ?></option>
  288. <?php   }
  289. } while ($catNames = mysql_fetch_assoc($getCatNames)); ?>
  290. </select>
  291. </td>
  292. </tr>
  293. <?php if ($_GET['edit'] != 1) { ?>
  294. <tr>
  295. <td valign="top" align="left">
  296. <label for="link_location">Page Link Location: </label>
  297. </td>
  298. <td valign="top" align="left">
  299. <input name="linklocation1" id="link_location" type="checkbox" value="1" <? if ($linkOpt[0] == 1) { echo 'checked="checked"'; } ?> /> Top Navigation<br />
  300. <input name="linklocation2" type="checkbox" value="1" <? if ($linkOpt[1] == 1) { echo 'checked="checked"'; } ?> /> Side Navigation<br />
  301. <input name="linklocation3" type="checkbox" value="1" <? if ($linkOpt[2] == 1) { echo 'checked="checked"'; } ?> /> Footer Links<br />
  302. </td>
  303. </tr>
  304. <?php } ?>
  305. <!-- BANNER MOD -->
  306. <td valign="top" align="left">
  307. <label for="page_banner">Page Banner: </label>
  308. </td>
  309. <td valign="top" align="left">
  310. <select name="pageBanner" id="page_banner" />
  311. <option value="nobanner" selected="selected">No Banner</option>
  312. <option value="usebanner">Use Banner</option>
  313. </select>
  314. </td>
  315. </tr>
  316. <tr>
  317. <td valign="top" align="left">
  318. <label for="page_banner_img">Page Banner Image: </label>
  319. </td>
  320. <td>
  321. <input type="file" name="pageBannerImg" id="page_banner_img" value="<?php echo $editCat['pageBanner2'];?>" />
  322. </td>
  323. </tr>
  324. <?php
  325. $imagefileloc = $editCat['pageBanner2'];
  326.  ?>
  327. <tr>
  328. <td valign="top" align="left">
  329. <label for="page_banner_alt">Page Banner Alt: </label>
  330. </td>
  331. <td>
  332. <input name="pageBannerAlt" type="text" id="page_banner_alt" class="adminInput" value="<?php echo $editCat['pageBanner3']; ?>" /><br />
  333. </td>
  334. </tr>
  335. <tr>
  336. <td valign="top" align="left" colspan="2">
  337. <?php
  338. if ($imagefileloc != NULL) {
  339. echo'<img src="'.$imagefileloc.'" alt="'.$editCat['pageBanner3'].'" />';
  340. }
  341. ?>
  342. </td>
  343. </tr>
  344. <!-- END -->
  345. <tr>
  346. <td valign="top" align="left" colspan="2">
  347. <?php
  348. $oFCKeditor = new FCKeditor('editContent');
  349. $oFCKeditor->BasePath = 'includes/rte/';
  350. $oFCKeditor->Value = $editCat['content'];
  351. $oFCKeditor->Create();
  352. ?>
  353. </td>
  354. </tr>
  355. </table>
  356. <input type="hidden" name="editID" value="<?php echo $_GET['edit']; ?>" />
  357. <input type="hidden" name="oldParent" value="<?php echo $_GET['p']; ?>" />
  358. <input type="hidden" name="pd_edited" value="yes" />
  359. <!-- BANER MOD -->
  360. <input type="hidden" name="pageBannerUsed" value="<?php echo $pageBannerUsed; ?>" />
  361. <!-- END -->
  362. <input value="Edit Page" type="submit" class="padSubmit" />
  363. </form>
  364. </fieldset>
  365.  
  366. <?php } else {
  367. // add page html
  368. ?>
  369.  
  370.  
  371. <fieldset>
  372. <legend>Add Page</legend>
  373. <form enctype="multipart/form-data" action="index.php?ad=pd" method="post" name="updateDetails">
  374. <table cellpadding="4" cellspacing="0" border="0" width="100%">
  375. <tr>
  376. <td valign="top" align="left">
  377. <label for="add_page">Page Name/Title: </label>
  378. </td>
  379. <td valign="top" align="left">
  380. <input name="addThisPage" type="text" class="adminInput" id="add_page" />
  381. </td>
  382. </tr>
  383. <tr>
  384. <td valign="top" align="left">
  385. <label for="parent_page">Parent Page: </label>
  386. </td>
  387. <td valign="top" align="left">
  388. <select name="parentPage" id="parent_page" />
  389. <option value="noparent" selected="selected">No Parent</option>
  390. <?php
  391. // repeat cat names options
  392. do {
  393.     if ($catNames['id'] !== NULL && $catNames['parent'] == 0 && $catNames['id'] != 1) { ?>
  394.     <option value="<?php echo $catNames['id'] ?>"><?php echo $catNames['name'] ?></option>
  395. <?php }
  396. } while ($catNames = mysql_fetch_assoc($getCatNames)); ?>
  397. </select>
  398. </td>
  399. </tr>
  400. <tr>
  401. <td valign="top" align="left">
  402. <label for="link_location">Page Link Location: </label>
  403. </td>
  404. <td valign="top" align="left">
  405. <input name="linklocation1" id="link_location" type="checkbox" value="1" /> Top Navigation<br />
  406. <input name="linklocation2" type="checkbox" value="1" checked="checked" /> Side Navigation<br />
  407. <input name="linklocation3" type="checkbox" value="1" /> Footer Links<br />
  408. </td>
  409. </tr>
  410.  
  411. <!-- BANNER MOD -->
  412. <tr>
  413. <td valign="top" align="left">
  414. <label for="page_banner">Page Banner: </label>
  415. </td>
  416. <td valign="top" align="left">
  417. <select name="pageBanner" id="page_banner" />
  418. <option value="nobanner" selected="selected">No Banner</option>
  419. <option value="usebanner">Use Banner</option>
  420. </select>
  421. </td>
  422. </tr>
  423. <tr>
  424. <td valign="top" align="left">
  425. <label for="page_banner_img">Page Banner Image: </label>
  426. </td>
  427. <td>
  428. <input type="file" name="pageBannerImg" id="page_banner_img" value="<?php echo $catNames['pageBanner2'];?>" />
  429. </td>
  430. </tr>
  431. <?php
  432. $imagefileloc = $catNames['pageBanner2'];
  433. ?>
  434. <tr>
  435. <td valign="top" align="left">
  436. <label for="page_banner_alt">Page Banner Alt: </label>
  437. </td>
  438. <td>
  439. <input name="pageBannerAlt" type="text" id="page_banner_alt" class="adminInput" value="<?php echo $catNames['pageBanner3']; ?>" /><br />
  440. </td>
  441. </tr>
  442. <tr>
  443. <td valign="top" align="left" colspan="2">
  444. <?php
  445. if ($imagefileloc != NULL) {
  446. echo'<img src="'.$imagefileloc.'" alt="'.$catNames['pageBanner3'].'" />';
  447. }
  448. ?>
  449. </td>
  450. </tr>
  451. <!-- END -->
  452. <tr>
  453. <td valign="top" align="left" colspan="2">
  454. <?php
  455. $oFCKeditor = new FCKeditor('addContent');
  456. $oFCKeditor->BasePath = 'includes/rte/';
  457. $oFCKeditor->Value = "";
  458. $oFCKeditor->Create();
  459. ?>
  460. </td>
  461. </tr>
  462. </table>
  463. <input type="hidden" name="pd_updated" value="yes" />
  464. <input type="hidden" value="pageBannerUsed" value="0">
  465. <input value="Add Page" type="submit" class="padSubmit" />
  466. </form>
  467. </fieldset>
  468.  
  469. <?php } ?>
  470.  
  471. <fieldset>
  472. <legend>Current Pages</legend>
  473.  
  474. <strong>Home</strong> [<a href="index.php?ad=pd&edit=1">edit</a>]<br />
  475.  
  476. <?php
  477. // repeat category listings
  478. do {
  479.     if ($topCat['id'] !== NULL && $topCat['parent'] == 0 && $topCat['id'] != 1) {
  480.     echo '<br /><strong>'.$topCat['name'].'</strong>
  481.     [<a href="index.php?ad=pd&edit='.$topCat['id'].'">edit</a>] ';
  482.        
  483.         // delete if category has no links
  484.         if ($topCat['counter'] == 0 && $topCat['subCategories'] == 0) {
  485.         echo '[<a href="index.php?ad=pd&delete='.$topCat['id'].'">delete</a>]<br />';
  486.         } else {
  487.         echo '[<span style="color:grey">delete</span>]<br />';
  488.         }
  489.  
  490.         $getSubCat = mysql_query("SELECT * FROM affiliSt_pages ORDER BY parent ASC, name ASC");
  491.         $subCat = mysql_fetch_assoc($getSubCat);
  492.    
  493.         // repeat sub category listings
  494.         do {
  495.            
  496.             if ($subCat['parent'] == $topCat['id']) {
  497.             echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;'.$subCat['name'].'
  498.             [<a href="index.php?ad=pd&edit='.$subCat['id'].'&p='.$subCat['parent'].'">edit</a>] ';
  499.        
  500.                 // delete if category has no links
  501.                 if ($subCat['counter'] == 0) {
  502.                 echo '[<a href="index.php?ad=pd&delete='.$subCat['id'].'&p='.$subCat['parent'].'">delete</a>]<br />';
  503.                 } else {
  504.                 echo '[<span style="color:grey">delete</span>]<br />';
  505.                 }
  506.             }
  507.         } while ($subCat = mysql_fetch_assoc($getSubCat));
  508.     }
  509. } while ($topCat = mysql_fetch_assoc($getTopCat)); ?>
  510. </fieldset>

7. Admin/css
Modify admin.css #pageSurround fieldset {}
width: 738px -> width:798px;

8. Style -> StyleSheet
add to style.css:

CSS:
  1. /**************/
  2. /* Banner Mod */
  3. /**************/
  4. #pageBanner {
  5.     position: relative;
  6.     float:left;
  7.     margin: 0;
  8.     padding: 0;
  9.     width: 740px;
  10.     max-height: 200px;
  11.     clear: both;
  12. }
  13. #pgHead {
  14.     position: relative;
  15.     float: left;
  16.     width: 300px;
  17.     height: 0px
  18.     margin: 0;
  19.     padding: 0px;
  20. }
  21. #pgHead ul {
  22.     float:left;
  23. }
  24. #pgHead ul li {
  25.     list-style: none;
  26.     display: block;
  27.     width: 300px;
  28.     height: 0;   
  29.     margin: 175px 0 0 0;
  30.     background-color: transparent;
  31.     padding: 0;
  32.     }
  33. /** End */

Backup files as you go!!

Can be seen at http://www.iwatches.co.uk

... support my developments, buy a watch!!

Leave a Reply