Solved

Problem with displaying all of template

Posted on 2006-06-17
4
249 Views
Last Modified: 2010-04-25
Hi all,
I have a page that I'm applying a template to. The template has a news scroller in it and therefore has information in the header. When I apply the template to a page with no header information the template displays fine but when I need to specify where I want the header information for the child page to be displayed (i.e head, nowhere, etc) the information from the database inside is the scroller is not displayed at all. How can I solve this?
Thanks,
D
0
Comment
Question by:dereksheahan
  • 2
  • 2
4 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 16936574
Derek,

If you apply a template to a blank page, the whole template code executes and the dependent code for the scroller should be unaffected.  If you mess with the header on the child page, it may comment out that dependent code and screw the scroller.  I'm not sure why this is a variable for you...why are modifying the headers on a case by case basis?

One possible solution is to implement multiple templates that cover all the different options.
0
 

Author Comment

by:dereksheahan
ID: 16982626
Hi Jason,
Hope you're well. Was on holidays there for a week :). The link for this page is http://www.corkgsm.com/Postal/postalmain.php so you can see what's going on. As you can see the scroller on the left side is blank on this page. Here's how I attached the template. I've tried putting the header section in all of the different positions on the template wizard page (i.e. in header, nowhere, etc) but none of them work properly.

So here's the child page with the template attached. I wonder is there an easier way for you to look at this. If you'd like me to put up the file for you so you can view it easier in DW I can do that.

Thanks so much,
D

<?php require_once('../Connections/GSM_backup.php'); ?>
<?php
mysql_select_db($database_GSM_mobile, $dbh);
$query_rsPostalfromDB = "SELECT type_type_id, type_type_name, type_category_id, image_src FROM type_table WHERE type_category_id = 3";
$rsPostalfromDB = mysql_query($query_rsPostalfromDB, $dbh) or die(mysql_error());
$row_rsPostalfromDB = mysql_fetch_assoc($rsPostalfromDB);
$totalRows_rsPostalfromDB = mysql_num_rows($rsPostalfromDB);
?><!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"><!-- InstanceBegin template="/Templates/business.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Free Vertical News Scroller - Multiple Message Scroller V3.0</title>
<!-- InstanceEndEditable -->
<!-- STEP I: Goes between <HEAD> & </HEAD> tags
             You may keep it, change or ignore it!
             Or linking to an External Style Sheet:
         <LINK REL=StyleSheet HREF="yourstyle.css">
             without other style tags -->

<style type="text/css">
A { text-decoration:none;}
A:link      {color:blue;}
A:visited{color: blue;}
A:hover      {color: red;background-color:#66ffff;}
 .tabb { font-weight:bold; font-size:14px; font-family:Arial,Helvetica;}
 .tan {FONT-SIZE: 12px; COLOR: navy; FONT-FAMILY: Arial,Helvetica; TEXT-ALIGN: center}
 .tann {FONT-WEIGHT: bold;FONT-SIZE: 18px; COLOR: navy; FONT-FAMILY: Arial,Helvetica; TEXT-ALIGN: center}
#testimonial {
      border: thin solid #FFFFFF;
}
#Layer8 {
      position: relative;
}
</style>

<!-- STEP II: Goes between <HEAD> & </HEAD> tags
              Or linking to an External js file:
<script language="javascript" src="yourfile.js"></script>
              without other script tags -->

<SCRIPT LANGUAGE="JavaScript">

/***********************************
*   http://javascripts.vbarsan.com/
*   This notice may not be removed
***********************************/

//-- Begin Scroller's Parameters and messages -->
//scroller's width
var swidth=206;

//scroller's height
var sheight=20;


//scroller's speed
var sspeed=1;
var restart=sspeed;
var rspeed=sspeed;

//scroller's background
sbcolor="#ccffcc";

//messages: set your own; use as many as you'd like; set up Hyperlinks to
//URLs as you normally do: <a target=... href="... URL ...">..message..</a>;
var singletext=new Array();
singletext[0]='<?php echo $content; ?>';

//-- begin: Scroller's Algorithm -->
if (singletext.length>1)ii=1;else ii=0;
function goup(){if(sspeed!=rspeed*8){sspeed=sspeed*2;restart=sspeed;}}
function godown(){if(sspeed>rspeed){sspeed=sspeed/2;restart=sspeed;}}
function start(){if (document.all){iens6div.style.top=sheight;iens6div.innerHTML=singletext[0];iescroll(iens6div);}else if (document.layers){document.ns4div.document.ns4div1.top=sheight;document.ns4div.document.ns4div1.visibility='show';document.ns4div.document.ns4div1.document.write(singletext[0]);document.ns4div.document.ns4div1.document.close();ns4scroll(document.ns4div.document.ns4div1);}else if (document.getElementById){document.getElementById('iens6div').style.top=sheight;document.getElementById('iens6div').innerHTML=singletext[0];ns6scroll(document.getElementById('iens6div'));}}
function iescroll(whichdiv){iediv=eval(whichdiv);sizeup=iediv.offsetHeight;if(iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed){iediv.style.pixelTop=0;setTimeout("iescroll(iediv)",100);}if(iediv.style.pixelTop>=sizeup*-1){iediv.style.pixelTop-=sspeed;setTimeout("iescroll(iediv)",100);}else{iediv.style.pixelTop=sheight;iediv.innerHTML=singletext[ii];if(ii==singletext.length-1)ii=0;else ii++;}}
function ns4scroll(whichlayer){ns4layer=eval(whichlayer);sizeup=ns4layer.document.height;if(ns4layer.top>0&&ns4layer.top<=sspeed){ns4layer.top=0;setTimeout("ns4scroll(ns4layer)",100);}if (ns4layer.top>=sizeup*-1){ns4layer.top-=sspeed;setTimeout("ns4scroll(ns4layer)",100);}else{ns4layer.top=sheight;ns4layer.document.write(singletext[ii]);ns4layer.document.close();if(ii==singletext.length-1)ii=0;else ii++;}}
function ns6scroll(whichdiv){ns6div=eval(whichdiv);sizeup=ns6div.offsetHeight;if(parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed){ns6div.style.top=0;setTimeout("ns6scroll(ns6div)",100);}if (parseInt(ns6div.style.top)>=sizeup*-1){ns6div.style.top=parseInt(ns6div.style.top)-sspeed;setTimeout("ns6scroll(ns6div)",100);}else{ns6div.style.top=sheight;ns6div.innerHTML=singletext[ii];if(ii==singletext.length-1)ii=0;else ii++;}}
//-- end Algorithm -->
</script>
<!-- End of Script between <head> & </head> tags-->


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FireFox Template</title>
<style type="text/css">
<!--
#background {
      position:absolute;
      left:27px;
      top:284px;
      width:805px;
      height:452px;
      z-index:1;
      background-color: #448bbf;
      visibility: visible;
}
A { text-decoration:none;}
A:link     {color:blue;}
A:visited{color: blue;}
A:hover     {color: white; background-color:#448bbf;}

#Layer2 {
      position:absolute;
      left:34px;
      top:282px;
      width:222px;
      height:407px;
      z-index:2;
      background-color: #448BBF;
}
#ads {
      position:absolute;
      left:712px;
      top:284px;
      width:113px;
      height:450px;
      z-index:3;
      background-color: #448BBF;
      border-top-style: ridge;
      border-right-style: ridge;
      border-bottom-style: none;
      border-left-style: ridge;
      border-top-color: #FFFFFF;
      border-right-color: #FFFFFF;
      border-bottom-color: #FFFFFF;
      border-left-color: #FFFFFF;
      visibility: visible;
}
#testimonial {
      position:absolute;
      left:26px;
      top:283px;
      width:218px;
      height:231px;
      z-index:8;
      background-color: #448bbf;
      visibility: visible;
}
#tell_a_friend {
      position:absolute;
      left:27px;
      top:521px;
      width:211px;
      height:242px;
      z-index:5;
      background-color: #448bbf;
      visibility: visible;
}
#flashholder {
      position:absolute;
      left:35px;
      top:5px;
      width:780px;
      height:200px;
      z-index:6;
      background-color: #996699;
      visibility: visible;
}
#mainselectholder {
      position:absolute;
      left:35px;
      top:220px;
      width:780px;
      height:78px;
      z-index:7;
      visibility: visible;
}
#testimonial {
      border-top-width: thin;
      border-right-width: thin;
      border-bottom-width: thin;
      border-left-width: thin;
      border-top-style: none;
      border-right-style: none;
      border-bottom-style: none;
      border-left-style: none;
      border-top-color: #000000;
      border-right-color: #000000;
      border-bottom-color: #000000;
      border-left-color: #000000;
}
#bottom {
      position:absolute;
      left:25px;
      top:736px;
      width:800px;
      height:40px;
      z-index:8;
      background-color: #b7d8e4;
      visibility: visible;
}
#Layer1 {
      position:absolute;
      left:253px;
      top:289px;
      width:452px;
      height:444px;
      z-index:9;
      background-color: #448BBF;
      overflow: auto;
      visibility: visible;
}
#Layer3 {
      position:absolute;
      left:84px;
      top:494px;
      width:125px;
      height:16px;
      z-index:10;
      background-color: #448BBF;
      visibility: visible;
}
#tell_a_friend {
      padding: 3px;
      border-top-style: none;
      border-right-style: ridge;
      border-bottom-style: ridge;
      border-left-style: ridge;
      border-top-color: #FFFFFF;
      border-right-color: #FFFFFF;
      border-bottom-color: #FFFFFF;
      border-left-color: #FFFFFF;
}
#bottom {
      border-top-style: ridge;
      border-right-style: ridge;
      border-bottom-style: ridge;
      border-left-style: ridge;
}
#testimonial {
      border: medium ridge #FFFFFF;
}
.style3 {font-family: Arial, Helvetica, sans-serif}
.style4 {font-family: Geneva, Arial, Helvetica, sans-serif}
.style5 {font-size: 14px}
.style8 {
      font-family: Geneva, Arial, Helvetica, sans-serif;
      font-weight: bold;
      color: #FFFFFF;
}
.style10 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
-->
</style>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<BODY onLoad="start()">
<div id="background"></div>
<div id="ads">
  <p class="style4"><img src="../Images/little.png" width="11" height="16" /> <strong>What's New:</strong> </p>
  <p class="style8"><a href="../Remote/nokiaremote.php">Nokia Security Code Removal </a></p>
  <p align="center" class="style4"><img src="../Images/little.png" alt="Our Advertisers" width="11" height="16" /> <span class="style10">Advertisers: </span></p>
  <p><img src="../Images/freedommoblogo_resized.png" width="109" height="71" /></p>
</div>
<div id="testimonial">

                                                      <table cellpadding="0" cellspacing="0">
                                          <tbody><tr>
                              <th valign="top">
                                                            <div align="center" class="style3"><span class="style4"><img src="../Images/little.png" alt="Image" width="11" height="16" /></span> Testimonials:</div></th>
                        </tr>
                                          <tr>
                        <td>
                         <table class="moduletable" align="justify" height="185" width="214">
           <tbody><tr>
            <td width="208" height="179">
             <marquee loop="infinite" behavior="scroll" direction="up" height="180px" width="205" scrollamount="1" scrolldelay="65" truespeed="" onmouseover="this.stop()" onmouseout="this.start()"><?php echo $content; ?> <br> </marquee>
            </td>
           </tr>
          </tbody></table>                        </td>
                  </tr>
                  </tbody></table>
</div>
<div id="tell_a_friend">
<?php
/* Recommend this website to a friend
Script Version 0.2, copyright RRWH.com 2005.

This script is distributed under the licence conditions on the website http://rrwh.com/scripts.php

You only need to modify 3 variables - the $my_email, $safe_domains and $message

To use this script, simply set the 3 variables, upload it to your website and on the page you wish it to appear
add the following php code
      <?php include("contact2.php"); ?>
This script creates the form, and outputs a message on sucess.
*/

// your email address - so you get copies - in case of abuse.
$my_email = 'info@reachateacher.ie';
// set the safe domains to your own domain names
$safe_domains = array('www.reachateacher.ie',);

// check if we are being submitted, and if we are, process it and output a message
if ((isset($_POST['email_friend'])) && ($_POST['email_friend'] == 'Recommend') ) {
      addslashes(extract($_POST));
      // this is the message you send when the form is completed.
      // DO NOT remove any words enclosed in "< >" as they get substituted for form values
      $message = '
      
      Hello <tellfriend>

Your friend <tellname>, <tellemail> visited our website at
http://corkgsm.com and wanted to share it with you the great services we have to offer.
      
Please check out our site to see the great range of services we have to offer!

      ';

// No need to modify ANYTHING below.

      // Check REFERER to minimise Abuse
      $i = count($safe_domains) - 1;
      while ($i >= 0) {
            if (strpos($_SERVER['HTTP_REFERER'], "http://$safe_domains[$i]") === 0) {
            $safe = "yes";
            }
      $i--;
      }
      // make sure form fields have been filled in, name is optional
      if ( ($safe == "yes") && (($tellemail != '' ) || ($tellfriend != '' ))) {
            $regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
            $sendervalid = 'Nope';
            $rxvalid = 'Nope';
            if (eregi($regexp, $tellemail)){
                  $sendervalid = 'Yes';
            }
            if (eregi($regexp, $tellfriend)){
                  $rxvalid = 'Yes';
            }
            if (($sendervalid == 'Yes') && ($rxvalid == 'Yes')) {
                  // valid to and from address
                  $good = 'yes';
            }
      }
      
      if ($good =='yes') {
            // form data validated.
            $subject = 'Recommended Website';
            $headers = "From: <$tellemail>\r\n";
            $fmtMail = str_replace("<tellfriend>", $tellfriend, $message);
            $fmtMail = str_replace("<tellname>", $tellname, $fmtMail);
            $fmtMail = str_replace("<tellemail>", $tellemail, $fmtMail);
            $frommail = $_SERVER["REMOTE_ADDR"];
            $fmtMail2 = "$fmtMail \n\n Remote IP is $frommail \n\n\n";
            
            //echo "$tell_friend - $subject \n";
            // send message
            mail($tellfriend, $subject, $fmtMail, $headers, "-f$tellemail");
            // send message to admin address
            mail($my_email, $subject, $fmtMail2, $headers, "-f$tellemail");
            
      }
}
?>
<form action="#" method="post" name="tellfriend">
<div align="center">
  <legend><span class="style3"><span class="style4"><img src="../Images/little.png" alt="Tell a Friend" width="11" height="16" /></span> <strong>Tell a friend:</strong></span></legend>
  <p><span class="style5">Your name:</span><br>
    <input type="text" size="14" name="tellname">
    <br>
    <span class="style5">Your e-mail:</span><br>
    <input type="text" size="14" name="tellemail">
    <br>
    <span class="style5">Friend's e-mail:</span><br>
    <input type="text" size="14" name="tellfriend">
  </p>
  </div>
<p align="center">
  <input type="submit" name="email_friend" value="Recommend" />
</p>
</form></div>
<div id="flashholder">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="780" height="200">
    <param name="movie" value="../Images/GSMActual.swf" />
    <param name="quality" value="high" />
    <embed src="../Images/GSMActual.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="780" height="200"></embed>
  </object>
</div>
<div id="mainselectholder">
  <div align="center"></div>
  <!-- InstanceBeginEditable name="Heading" -->
  <table width="400" border="0" align="center" bgcolor="#FFFFFF">
    <tr>
      <td><a href="../Remote/remotemainlive.php"><img src="../green.gif" border="0" width="186" height="42" alt="s" /></a></td>
      <td><img src="../Images/orange.png" alt="Server Unlock" width="172" height="42" /></td>
      <td><a href="postalmain.php"><img src="../Images/blue.gif" border="0" width="181" height="42" alt="g" /></a></td>
    </tr>
  </table><!-- InstanceEndEditable -->
 
</div>
<div id="bottom">
  <div align="center">
    <p style="padding-top:20; padding-left:30; color:ffffff; font-family:tagoma; font-size:10px">2006 (c) Copyright Cork GSM. All rights reserved. Brought to you by Freedom Mobile </p>
  </div>
</div>
<div id="Layer1"><!-- InstanceBeginEditable name="Main Section" -->
<form id="form1" name="form1" method="post" action="">
Please Select Your Phone Brand:
  <table border="1" >
    <tr>
      <?php
$rsPostalfromDB_endRow = 0;
$rsPostalfromDB_columns = 3; // number of columns
$rsPostalfromDB_hloopRow1 = 0; // first row flag
do {
    if($rsPostalfromDB_endRow == 0  && $rsPostalfromDB_hloopRow1++ != 0) echo "<tr>";
   ?>
      <td><a href="jasontester.php?Type_variable=<?php echo $row_rsPostalfromDB['type_type_id']; ?>"><img src="http://localhost/GSM/Images/<?php echo $row_rsPostalfromDB['image_src']; ?>" alt="<?php echo $row_rsPostalfromDB['type_type_name']; ?>" border="0" /></a></td>
      <?php  $rsPostalfromDB_endRow++;
if($rsPostalfromDB_endRow >= $rsPostalfromDB_columns) {
  ?>
    </tr>
    <?php
 $rsPostalfromDB_endRow = 0;
  }
} while ($row_rsPostalfromDB = mysql_fetch_assoc($rsPostalfromDB));
if($rsPostalfromDB_endRow != 0) {
while ($rsPostalfromDB_endRow < $rsPostalfromDB_columns) {
    echo("<td>&nbsp;</td>");
    $rsPostalfromDB_endRow++;
}
echo("</tr>");
}?>
  </table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</form>
<!-- InstanceEndEditable --></div>
<div id="Layer3"><a href="../feedback.php">Add your comment: </a></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($rsPostalfromDB);
?>
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 17032115
Hi Derek,

Templates should not be applied to pages where there is existing content as the template code will overwrite page elements not in editable regions...

Either embed the scroller into the template and then apply the whole thing to a new blank page OR apply the template to get the look right, then add the scroller.  You may have to change your template code to have a bigger editable region to manage the latter.

That's sort of what I meant by having two templates.  If the scroller is not on every page, it may be easier to have a second template that is identical to the first only also containing the scroller code.  Then you apply template1 to normal pages and template2 to pages that also need the scroller.
0
 

Author Comment

by:dereksheahan
ID: 17032160
Thanks Jason,
I guess I'll close this question and put a new one up as this one is answered.
Cheers,
D
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now