chrometweaks.org

Which Content Management Service and which web iPage hosting service should I use?

Click Here To View All Answers...


My first question is Which Content Management Service and which web iPage hosting service should I use? Looking forward for any comment. Another question I got... I want to add javascript in order to rotate my logo image in my header, so far I have gotten great amounts of help and would like to thank you all this is truly a great support forum..

Since I know close to nothing in php I cant seem to figure this out here is my header code (NOTE: I dont want to use my logo image anymore this would be substituted by the images in the javascript.).

<?php.

/*.

$Id: header.php,v 1.1 2003/09/08 19:25:59 jhtalk Exp jhtalk $.

OsCommerce, Open Source E-Commerce Solutions.

Http://www.oscommerce.com.

Copyright (c) 2003 osCommerce.

Released under the GNU General Public License.

*/.

// STS: ADD.

$sts_block_name = 'applicationtop2header';.

Require(STS_RESTART_CAPTURE);.

// STS: EOADD.

// check if the 'install' directory exists, and warn of it's existence.

If (WARN_INSTALL_EXISTENCE == 'true') {.

  if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME'])'/install')) {.

    $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');.

  }.

}.

// check if the configure.php file is writeable.

If (WARN_CONFIG_WRITEABLE == 'true') {.

  if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME'])'/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME'])'/includes/configure.php')) ) {.

    $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');.

  }.

}.

// check if the session folder is writeable.

If (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {.

  if (STORE_SESSIONS == '') {.

    if (!is_dir(tep_session_save_path())) {.

      $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');.

    } elseif (!is_writeable(tep_session_save_path())) {.

      $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');.

    }.

  }.

}.

// check session.auto_start is disabled.

If ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {.

  if (ini_get('session.auto_start') == '1') {.

    $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');.

  }.

}.

If ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {.

  if (!is_dir(DIR_FS_DOWNLOAD)) {.

    $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');.

  }.

}.

If ($messageStack->size('header') > 0) {.

  echo $messageStack->output('header');.

}.

?>.

<table border="0" width="100%" cellspacing="0" cellpadding="0">.

<tr class="header">.

  <td valign="middle"><?php echo '<a href="'tep_href_link(FILENAME_DEFAULT)'">'tep_image(DIR_WS_IMAGES'logo.jpg', 'osCommerce')'</a>'; ?></td>.

  <td align="right" valign="bottom"><?php echo '<a href="'tep_href_link(FILENAME_ACCOUNT, '', 'SSL')'">'tep_image(DIR_WS_IMAGES'header_account.gif', HEADER_TITLE_MY_ACCOUNT)'</a>&nbsp;&nbsp;<a href="'tep_href_link(FILENAME_SHOPPING_CART)'">'tep_image(DIR_WS_IMAGES'header_cart.gif', HEADER_TITLE_CART_CONTENTS)'</a>&nbsp;&nbsp;<a href="'tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')'">'tep_image(DIR_WS_IMAGES'header_checkout.gif', HEADER_TITLE_CHECKOUT)'</a>'; ?>&nbsp;&nbsp;</td>.

</tr>.

</table>.

<table border="0" width="100%" cellspacing="0" cellpadding="1">.

<tr class="headerNavigation">.

  <td class="headerNavigation">&nbsp;&nbsp;<?php echo $breadcrumb->trail(' &raquo; '); ?></td>.

  <td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a> &nbsp;|&nbsp; <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> &nbsp;|&nbsp; <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> &nbsp;|&nbsp; <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> &nbsp;&nbsp;</td>.

</tr>.

</table>.

<?php.

If (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {.

?>.

<table border="0" width="100%" cellspacing="0" cellpadding="2">.

<tr class="headerError">.

  <td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>.

</tr>.

</table>.

<?php.

}.

If (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {.

?>.

<table border="0" width="100%" cellspacing="0" cellpadding="2">.

<tr class="headerInfo">.

  <td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td>.

</tr>.

</table>.

<?php.

}.

// STS: ADD.

$sts_block_name = 'header';.

Require(STS_RESTART_CAPTURE);.

// STS: EOADD.

?>.

And here is the javascript I would like to use:.

[CODE].

// This script was supplied free by Hypergurl.

//.

Http://www.hypergurl.com.

<!.

// JavaScript to interpolate random images into a page..

Var ic = 4; // Number of alternative images.

Var xoxo = new Array(ic); // Array to hold filenames.

//the images I used were in the same folder as the page, if your images are in the images folder than put images/image.jpg.

Xoxo[0] = "construction_5x2.gif";.

Xoxo[1] = "garden_5x2.gif";.

Xoxo[2] = "kitchen_5x2.gif";.

Xoxo[3] = "living_5x2.gif";.

Function pickRandom(range) {.

If (Math.random).

Return Math.round(Math.random() * (range-1));.

Else {.

Var now = new Date();.

Return (now.getTime() / 1000) % range;.

}.

}.

// Write out an IMG tag, using a randomly-chosen image name..

Var choice = pickRandom(ic);.

// >.

<script LANGUAGE="JavaScript">.

Document.writeln('<TD ROWSPAN=1 COLSPAN=6 WIDTH=469 HEIGHT=105><IMG name=homepage8 SRC="'+xoxo[choice]+'" HEIGHT=105 WIDTH=469 BORDER=0><'+'/TD>');.

</SCRIPT>.

[CODE].

This is probably simple I just want to know exactly qhere I should embed the javascript and what part of the code that is already ther I would have to ommit.

, also I dont understand where he says in the javascript part and the html part where are these located, well any help I can get would be awesome thanks again guys...

Comments (4)

That's a good question. I'm not sure what is the right answer. I'll do some research and get back to you if I find an decent answer. You should email the people at iPage as they probably could answer your iPage question..

Comment #1

Ok so I do it in every php file or how do you mean??.

I'm using the STS Contrib which is the templating system with the use of an html page and I tried putting it on there and it wont work any other suggestions??..

Comment #2

Allright your header.php must look like this :.

<?php.

/*.

$Id: header.php,v 1.1 2003/09/08 19:25:59 jhtalk Exp jhtalk $.

OsCommerce, Open Source E-Commerce Solutions.

Http://www.oscommerce.com.

Copyright (c) 2003 osCommerce.

Released under the GNU General Public License.

*/.

///// here we insert the javascript.

?>.

<html>.

<head>.

<script language="JavaScript">.

//<!.

// JavaScript to interpolate random images into a page..

Var ic = 4; // Number of alternative images.

Var xoxo = new Array(ic); // Array to hold filenames.

//the images I used were in the same folder as the page, if your images are in the images folder than put images/image.jpg.

Xoxo[0] = "construction_5x2.gif";.

Xoxo[1] = "garden_5x2.gif";.

Xoxo[2] = "kitchen_5x2.gif";.

Xoxo[3] = "living_5x2.gif";.

Function pickRandom(range) {.

If (Math.random).

Return Math.round(Math.random() * (range-1));.

Else {.

Var now = new Date();.

Return (now.getTime() / 1000) % range;.

}.

}.

// Write out an IMG tag, using a randomly-chosen image name..

Var choice = pickRandom(ic);.

// >.

</script>.

</head>.

<?php.

//// end of insertion.

// STS: ADD.

$sts_block_name = 'applicationtop2header';.

Require(STS_RESTART_CAPTURE);.

// STS: EOADD.

// check if the 'install' directory exists, and warn of it's existence.

If (WARN_INSTALL_EXISTENCE == 'true') {.

 if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME'])'/install')) {.

   $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');.

 }.

}.

// check if the configure.php file is writeable.

If (WARN_CONFIG_WRITEABLE == 'true') {.

 if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME'])'/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME'])'/includes/configure.php')) ) {.

   $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');.

 }.

}.

// check if the session folder is writeable.

If (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {.

 if (STORE_SESSIONS == '') {.

   if (!is_dir(tep_session_save_path())) {.

     $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');.

   } elseif (!is_writeable(tep_session_save_path())) {.

     $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');.

   }.

 }.

}.

// check session.auto_start is disabled.

If ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {.

 if (ini_get('session.auto_start') == '1') {.

   $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');.

 }.

}.

If ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {.

 if (!is_dir(DIR_FS_DOWNLOAD)) {.

   $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');.

 }.

}.

If ($messageStack->size('header') > 0) {.

 echo $messageStack->output('header');.

}.

?>.

<table border="0" width="100%" cellspacing="0" cellpadding="0">.

<tr class="header">.

<!we put the code to replace the default osc logo image >.

  <td valign="middle">.

<script LANGUAGE="JavaScript">.

Document.writeln('<TD ROWSPAN=1 COLSPAN=6 WIDTH=469 HEIGHT=105><IMG name=homepage8 SRC="'+xoxo[choice]+'" HEIGHT=105 WIDTH=469 BORDER=0><'+'/TD>');.

</SCRIPT>.

</td>.

<!end of code  >.

 <td align="right" valign="bottom"><?php echo '<a href="'tep_href_link(FILENAME_ACCOUNT, '', 'SSL')'">'tep_image(DIR_WS_IMAGES'header_account.gif', HEADER_TITLE_MY_ACCOUNT)'</a>&nbsp;&nbsp;<a href="'tep_href_link(FILENAME_SHOPPING_CART)'">'tep_image(DIR_WS_IMAGES'header_cart.gif', HEADER_TITLE_CART_CONTENTS)'</a>&nbsp;&nbsp;<a href="'tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')'">'tep_image(DIR_WS_IMAGES'header_checkout.gif', HEADER_TITLE_CHECKOUT)'</a>'; ?>&nbsp;&nbsp;</td>.

</tr>.

</table>.

<table border="0" width="100%" cellspacing="0" cellpadding="1">.

<tr class="headerNavigation">.

 <td class="headerNavigation">&nbsp;&nbsp;<?php echo $breadcrumb->trail(' &raquo; '); ?></td>.

 <td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a> &nbsp;|&nbsp; <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> &nbsp;|&nbsp; <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> &nbsp;|&nbsp; <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> &nbsp;&nbsp;</td>.

</tr>.

</table>.

<?php.

If (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {.

?>.

<table border="0" width="100%" cellspacing="0" cellpadding="2">.

<tr class="headerError">.

 <td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>.

</tr>.

</table>.

<?php.

}.

If (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {.

?>.

<table border="0" width="100%" cellspacing="0" cellpadding="2">.

<tr class="headerInfo">.

 <td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td>.

</tr>.

</table>.

<?php.

}.

// STS: ADD.

$sts_block_name = 'header';.

Require(STS_RESTART_CAPTURE);.

// STS: EOADD.

?>.

Good code..

Comment #3

The first part of the code, yes. The 2nd part would only go wherever you want it to appear..

Manmachine obviously disagrees with me but if the JS needs to go in the HTML header, placing it where he suggested will not work unless STS completely changes where header.php is included...

Comment #4

U right ..

With STS contrib what I did will not work as the contrib don't use the header , but separate logo ..

So the best and this will work is to put the JS script directly in you sts_template.hml.

Here is the change to do on the original sts_template.html file :.

<html>.

<head>.

<!$headcontent>.

<link rel="stylesheet" type="text/css" href="stylesheet.css">.

<script language="JavaScript">.

//<!.

// JavaScript to interpolate random images into a page..

Var ic = 4; // Number of alternative images.

Var xoxo = new Array(ic); // Array to hold filenames.

//the images I used were in the same folder as the page, if your images are in the images folder than put images/image.jpg.

Xoxo[0] = "construction_5x2.gif";.

Xoxo[1] = "garden_5x2.gif";.

Xoxo[2] = "kitchen_5x2.gif";.

Xoxo[3] = "living_5x2.gif";.

Function pickRandom(range) {.

If (Math.random).

Return Math.round(Math.random() * (range-1));.

Else {.

Var now = new Date();.

Return (now.getTime() / 1000) % range;.

}.

}.

// Write out an IMG tag, using a randomly-chosen image name..

Var choice = pickRandom(ic);.

// >.

</script>.

</head>.

<body>.

<table width="100%" border="1" cellpadding="3" cellspacing="0">.

 <tr class="header">.

<!we put the code to replace the default $catlogo  from sts tag  >.

<td >.

<script LANGUAGE="JavaScript">.

Document.writeln('<TD ROWSPAN=1 COLSPAN=6 WIDTH=469 HEIGHT=105><IMG name=homepage8 SRC="'+xoxo[choice]+'" HEIGHT=105 WIDTH=469 BORDER=0><'+'/TD>');.

</SCRIPT>.

</td>.

<!end of code  >.

   <td><font size="1" face="Arial, Helvetica, sans-serif"> $cataloglogo</font></td>.

   <td><div align="right"><font size="1" face="Arial, Helvetica, sans-serif">.

       $myaccountlogo $cartlogo $checkoutlogo</font></div></td>.

 </tr>.

</table>.

<font size="1" face="Arial, Helvetica, sans-serif"><br>.

</font>.

<table width="100%" border="1" cellpadding="3" cellspacing="0">.

 <tr class="headerNavigation">.

   <td><font size="1" face="Arial, Helvetica, sans-serif">$breadcrumbs</font></td>.

   <td><div align="right"><font size="1" face="Arial, Helvetica, sans-serif">$myaccountlogoff.

       | $cartcontents | $checkout</font></div></td>.

 </tr>.

</table>.

<font size="1" face="Arial, Helvetica, sans-serif"><br>.

</font>.

<table width="100%" border="1" cellpadding="3" cellspacing="0">.

 <tr>.

   <td width="125" valign="top">.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$catmenu</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$categorybox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$manufacturerbox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$whatsnewbox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$searchbox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$informationbox</font></p></td>.

   <td valign="top">.

<p>$content</p>.

     </td>.

   <td width="125" valign="top">.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$cartbox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$maninfobox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$orderhistorybox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$bestsellersbox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$specialfriendbox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$reviewsbox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$languagebox</font></p>.

     <p><font size="1" face="Arial, Helvetica, sans-serif">$currenciesbox</font></p></td>.

 </tr>.

</table>.

<br>.

<table width="100%" border="1" cellpadding="3" cellspacing="0">.

 <tr>.

   <td><div align="center"><font size="1" face="Arial, Helvetica, sans-serif">$footer</font></div></td>.

 </tr>.

</table>.

<br>.

<table width="100%" border="1" cellpadding="3" cellspacing="0">.

 <tr>.

   <td><div align="center"><font size="1" face="Arial, Helvetica, sans-serif">$banner</font></div></td>.

 </tr>.

</table>.

<font size="1" face="Arial, Helvetica, sans-serif"><br>.

</font>.

<table width="100%" border="1" cellpadding="3" cellspacing="0">.

 <tr>.

   <td><font size="1" face="Arial, Helvetica, sans-serif">$date</font></td>.

   <td> <div align="right"><font size="1" face="Arial, Helvetica, sans-serif">$numrequests</font></div></td>.

 </tr>.

</table>.

<font size="1" face="Arial, Helvetica, sans-serif"><br>.

</font>.

<table width="100%" border="1" cellpadding="3" cellspacing="0">.

 <tr>.

   <td><font size="1" face="Arial, Helvetica, sans-serif">Copyright (C) 2003</font></td>.

   <td> <div align="right"><font size="1" face="Arial, Helvetica, sans-serif">Simple.

       Template System by <a href="http://www.Diamondsea.com/">DiamondSea.com</a></font></div>.

     <div align="right"></div></td>.

 </tr>.

</table>.

<p>&nbsp;</p>.

</body>.

</html>.

This will be ok.

Or if you want to still use header.php you must define a new tag in sts_user_code.php.

Like this :.

$sts_block_name = 'header';.

Require(STS_START_CAPTURE);.

Require(DIR_WS_INCLUDES'header.php');.

Require(STS_STOP_CAPTURE);.

$template['header'] = strip_unwanted_tags($sts_block['header], 'header');.

And then you can put the file header.php in your sts template by using this tag : $header.

Like this the file header.php I posted works !.

Good code..

Comment #5


This question was taken from a support group/message board and re-posted here so others can learn from it.