Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Simple Random Quotes

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-24-2004, 01:45 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default Simple Random Quotes

This is a simple Random Quotes script to be displayed on customers view. I use it for Cigar Quotes, you can use it for anything you want.

Step 1:
Create a file in /customer directory called rand_quotes.php with the following code in it:
Code:
<?php $quotes[] = "Cigars are my inspiration. Orson Welles"; $quotes[] = "A Cigar is like a Fantasy, lights up with tradition, enjoyed with imagination. Leon Fernandez"; $quotes[] = "I smoke in moderation. Only one cigar at a time. Mark Twain"; $quotes[] = "I drink a great deal. I sleep a little, and I smoke cigar after cigar. That is why I am in two-hundred-percent form. Winston Churchill"; srand ((double) microtime() * 1000000); $randomquote = rand(0,count($quotes)-1); echo " " . $quotes[$randomquote] . "</p>"; ?>

Note: Notice that you can create as many quotes as you like (I have about 30 on my Cigar Site), just add another line with:
Quote:
$quotes[] = "Your quote.
Author";

Step 2:
Create a file under /skin1/customer named rand_quotes.tpl with the following lines in it:
Code:
{* $Id: rand_quotes.tpl,v 1.0 2004/01/24 14:02:32 leon Exp $ *} {capture name=menu} <center> {include_php file="rand_quotes.php"} </center> {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title="Cigar Quotes" menu_content=$smarty.capture.menu }

Step 3:
In your /skin1/customer/home.tpl file add these lines above { include file="customer/categories.tpl" } or practically anywhere you want them to display:
Code:
{ include file="customer/rand_quotes.tpl" }

Enjoy !!!
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #2  
Old 01-25-2004, 05:19 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

I'm assuming this is for 3.5.3.

This is a nice mod, and anyone can see the potential for using it to display all types of random messages. Random coupon code display, Random announcement of specials etc.

Can we use Smarty tags in the php file for the display of the random text?
Reply With Quote
  #3  
Old 01-25-2004, 11:25 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

Quote:
Originally Posted by adpboss
I'm assuming this is for 3.5.3.

This is a nice mod, and anyone can see the potential for using it to display all types of random messages. Random coupon code display, Random announcement of specials etc.

Can we use Smarty tags in the php file for the display of the random text?

Yes for 3.5.3, but Im sure it's simple enough to work on quit any version.

Thats the main idea, I wanted to keep it simple but maybe further on I while make it more powerful, as this is like a Static Quote (you have to FTP the file when you make changes), but I have been thinking in making it dynamic on the admin side in order to change things whenever needed and as fast as possible.

Regarding Smarty, havent tried it, but as I have been learning Smarty, I can see that anything is possible, it is a good templating engine for sure, try it out and let us know.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #4  
Old 03-13-2004, 02:14 PM
 
shirtshop shirtshop is offline
 

Senior Member
  
Join Date: Nov 2002
Posts: 127
 

Default

When i use it there is a icon and a orange row. Can this be transparant and only the text? Can i use this instead of the welcome?
Reply With Quote
  #5  
Old 03-13-2004, 06:39 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

Quote:
Originally Posted by shirtshop
When i use it there is a icon and a orange row. Can this be transparant and only the text? Can i use this instead of the welcome?

The icon come out because the template system is calling a dingabat as an include file. Yes it can be transparent, just call it direct (not mentioning the added element as a Menu type).

As it says here:Step 3:
Quote:
Originally Posted by leon
In your /skin1/customer/home.tpl file add these lines above { include file="customer/categories.tpl" } or practically anywhere you want them to display:

You can add it instead of the welcome message of course. That way you can create a random welcome.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #6  
Old 03-13-2004, 07:03 PM
 
jeeya jeeya is offline
 

X-Adept
  
Join Date: May 2003
Location: USA
Posts: 807
 

Default

Why don't we just try Marquee, it's the easy way to show tex, just make new tpl and put the lines.


<marquee scrolldelay="140"><blink><font size="1" face="Arial">put your lines, quotes here</font></blink></marquee>.

__________________
X-Cart Version 4.1.8
Hosted on Linux
Reply With Quote
  #7  
Old 03-13-2004, 07:05 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

RP,

Please tell me you are kidding.

Blink and Marquee look terrible. Those were good effects like 4 years ago, but no one uses them now.

I'm not even sure they are compatible in every browser.
Reply With Quote
  #8  
Old 03-13-2004, 07:09 PM
 
jeeya jeeya is offline
 

X-Adept
  
Join Date: May 2003
Location: USA
Posts: 807
 

Default

I just saw many people using it, although I don't see much difference it php quotes and marquee, only webdesigner knows how they are being displayed, not many visitors does.
__________________
X-Cart Version 4.1.8
Hosted on Linux
Reply With Quote
  #9  
Old 03-13-2004, 07:14 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

It's random quotes. Marquee you have to sit there for ten minutes and wait for all of the information to scroll by. The average user doesn't have that long of an attention span when surfing.

Random quotes gives the impression of dynamic content. The content changes every page load. So the quotes are usually different and unique.

The customer either sees A, B or C. But not all 3 unless they keep refreshing the page.

It's a pretty big difference.
Reply With Quote
  #10  
Old 03-18-2004, 01:26 PM
 
shirtshop shirtshop is offline
 

Senior Member
  
Join Date: Nov 2002
Posts: 127
 

Default

it's working nice welcome for the customer.
How can i change the color and size?
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:22 AM.

   

 
X-Cart forums © 2001-2020