chrometweaks.org

What is the best, most efficient web iPage hosting service?

Click Here To View All Answers...


Got a question, hope someone can answer... What is the best, most efficient web iPage hosting service? Looking forward for any answer or 2. My other question... I was wondering if there was a way to randomize images in the logo so that I could have about 5 or 6 diferent logo background treatmentes and they would change every time the page refreshes. I know there is a way to do this with cgi and changing your html to shtml and here it is:.

STEP ONE.

Copy and paste the following HTML below into each HTML page that you want to have a random image displayed..

<!#include virtual="/cgi-bin/ranimage.cgi">.

STEP TWO.

After you have copied and pasted the HTML into your pages, now you need to change the extension of every page that includes this HTML from a .html or .htm file to a .shtml extension. In other words, if you have an HTML page named index.html that uses this random image display, then you need to rename the file to include the .shtml extension..

The reason this step is necessary is so the server knows to interpret a server-side include within the document. This is a line of code that the server must execute and place in your HTML file before someone views the document..

FINAL STEP.

When you install Random Images on your account, you specify a directory to contain the images to display when you use the Random Images code. You must now upload the images to be displayed into this directory. You can upload GIF or JPG image files, and the program will randomly select from all of the image files within this directory, regardless of the number of files it contains..

Now how would I implement this on my page, for my logo??..

Comments (128)

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

Comment #1

I had actually thought of that, however I wanted to see if I could keep the banners active separateley but in the end I guess i'll do that, although I do think that it would be a nice contrib for later use...

Comment #2

I tried to use that contrib but I couldn't get itto work tried it 9 times..

Comment #3

I'm using some code that was posted here first by Westkoast. click on the www link at the bottom of my post to see it in action on my store. It's not in the header but it would be easy enought to put it there..

If it does what you want I'll post the code here. Mine is set up to randmise 8 games or game categories..

Comment #4

Oh ok ok I saw it ok yeah thats basically what I am looking for now how would I put it on my site??.

Quick note I am using a contrib that allows you to template a page through the use of an html page and it has the $logo value there how would I make it to randomize it then I think this is the problem I had with the other contrib......

Comment #5

Ok I found this.

Ok, so the front index page I do this:.

I'm guessing thats the code your using..

However so do I make copies of the index.php's with diferent images and if so do you think it'll work for the logo when it goes to diferent pages that aren't the index??.

Thanks for all the help by the way really apreciate it..

Comment #6

I also found this ASP code that seems pretty simple to use, anyone have any ideas or comments on how to integrate it to my header instead of the logo.jpg value?.

<%.

Const numImg = 3.

Randomize.

Dim whichImg.

WhichImg = Int((numImg * Rnd) + 1).

%>.

<img src="<%=whichImg%>.jpg" width="770" height="83" border="0" alt="0">.

That one is for 3 images here are the instructions:.

I have the size already set up any ideas or suggestions? thanx for all the help....

I'll got to sllep now 'cause it's 5 AM see all of you tomorrow again...

Comment #7

I assume your logo is in /includes/header?.

No reason the PHP shouldn't work that I can see. To use that code exactly as it is yould need to add index_sb0.php, index_sub1.php etc to the includes directory. Just create the new PHP pages, add your different visual treatments to each and set the value ofx in rand()%x to the number of index_sub pages you've created and then put the code where you want the new pages with graphics to appear..

Not sure about your templating question. I don't use a templating system. This way is more manual and to make it work you'd need to overwrite what your templating system is doing. Someone else may have a better way. As ever back up first.........

Comment #8

Just befor a few days I was looking for randomizing page on my front page.

And found many threads on this forum about this..... so you can search for ideas..

I will post here script I took from another site.

<?php.

#This script has been developped by Nenad Motika [].

#Please feel free to use it and to contact me for any reason.

//read folder.

$folder=opendir(".");.

While ($file = readdir($folder)).

$names[count($names)] = $file;.

Closedir($folder);.

//sort file names in array.

Sort($names);.

//remove any non-images from array.

$tempvar=0;.

For ($i=0;$names[$i];$i++){.

$ext=strtolower(substr($names[$i],-4));.

If ($ext==".jpg"||$ext==".gif"||$ext=="jpeg"||$ext==".png"){$names1[$tempvar]=$names[$i];$tempvar++;}.

}.

//random.

Srand ((double) microtime() * 10000000);.

$rand_keys = array_rand ($names1, 2);.

//random image from array.

$slika=$names1[$rand_keys[0]];.

//image dimensions.

$dimensions = GetImageSize($slika);.

If (isset($pic)){header ("Location: $slika");}.

Else {echo "<img src=\"$slika\" $dimensions[3]>";}.

?>.

I am not using this way (it is not match for my needs) I made three different.

Language files (for different languages I using) and put in CATALOG/INDEX.PHP.

This lines.

<tr>.

           <td class="main"><?php srand((double)microtime()*1000000);.

$random = rand(1,3);.

Include(DIR_WS_LANGUAGES$language'/'mainpage$random .".php"); ?></td>.

         </tr>.

Instead lines TEXT_MAIN.

It is works for me..

Comment #9

Here is what I did for a iPage site I made found at.

Tchomeandgarden.

First put this in the javascript part of the page:.

// 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);.

// >.

Then in the html where you want the image to change put this:.

<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>.

Your gonna have to change the image size and table info in the last part of code but not a hard thing to do..

Done.

Goodluck,.

Ryan.

This post has been edited by.

Ryanf.

: 25 August 2004, 13:38..

Comment #10

I would do that in the header.php page right?..

Comment #11

Where exactly in the header sould I do this here is my header code:.

<?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.

?>..

Comment #12

I was wondering if there was a way to randomize images in the logo so that I could have about 5 or 6 diferent logo background treatmentes and they would change every time the page refreshes. I know there is a way to do this with cgi and changing your html to shtml and here it is:.

STEP ONE.

Copy and paste the following HTML below into each HTML page that you want to have a random image displayed..

<!#include virtual="/cgi-bin/ranimage.cgi">.

STEP TWO.

After you have copied and pasted the HTML into your pages, now you need to change the extension of every page that includes this HTML from a .html or .htm file to a .shtml extension. In other words, if you have an HTML page named index.html that uses this random image display, then you need to rename the file to include the .shtml extension..

The reason this step is necessary is so the server knows to interpret a server-side include within the document. This is a line of code that the server must execute and place in your HTML file before someone views the document..

FINAL STEP.

When you install Random Images on your account, you specify a directory to contain the images to display when you use the Random Images code. You must now upload the images to be displayed into this directory. You can upload GIF or JPG image files, and the program will randomly select from all of the image files within this directory, regardless of the number of files it contains..

Now how would I implement this on my page, for my logo??..

Comment #13

Why not just use the built in banner feature in osC? it'll randomize it and save you from coding anything new...

Comment #14


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