Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-02-2011, 04:59 AM   #1
Jdoughs
Confirmed User
 
Jdoughs's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Great White North
Posts: 5,794
Quick PHP Question.

I've got a check to see if it's a certain producttype (dog), and if so, something fits. Question is, can I have it be 'dog' and 'cat' and still have it as a line and not going into a if/else?

<-- Total noob, just learning.

Thanks in advance and Happy New Year.

PHP Code:
<?php if($this->product->productType == 'dog') { ?>        ruff ruff ruff            <?php ?>
Code:
<?php if($this->product->productType == 'dog') { ?>		ruff ruff ruff			<?php } ?>
__________________
LinkSpun - Premier Adult Link Trading Community - ICQ - 464/\281/\250
Be Seen By New Webmasters/Affiliates * Target out webmasters/affiliates based on niches your sites are for less than $20 a month.
AmeriNOC - Proudly hosted @ AmeriNOC!
Jdoughs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2011, 05:09 AM   #2
MrGusMuller
Confirmed User
 
MrGusMuller's Avatar
 
Industry Role:
Join Date: Oct 2010
Location: Portugal
Posts: 1,262
Sorry, but I havent understood ur question.
I have a lousy english.
But you have a variable set to be "dog" how can it be "dog" and "cat" at the same time?

<?php if($this->product->productType == 'dog' or $this->product->productType == 'cat') { ?>
__________________
StagCMS - Adult CMS - user friendly adult content management system - speed up your websites with no SQL connections
ICQ: 63*23*43*113

MrGusMuller is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2011, 05:19 AM   #3
Jdoughs
Confirmed User
 
Jdoughs's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Great White North
Posts: 5,794
Yes that is what I meant "OR".

If it is dog or cat. (could be both) I guess, bowls, toys, I don't know

THANKS!
__________________
LinkSpun - Premier Adult Link Trading Community - ICQ - 464/\281/\250
Be Seen By New Webmasters/Affiliates * Target out webmasters/affiliates based on niches your sites are for less than $20 a month.
AmeriNOC - Proudly hosted @ AmeriNOC!
Jdoughs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2011, 05:29 AM   #4
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
if( item==dog or item==cat ){ do stuff }
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2011, 08:43 AM   #5
cooldude7
Confirmed User
 
cooldude7's Avatar
 
Industry Role:
Join Date: Nov 2009
Location: Heaven
Posts: 4,306
Quote:
Originally Posted by grumpy View Post
if( item==dog or item==cat ){ do stuff }
do stuff with whom ?
cooldude7 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2011, 08:55 AM   #6
Sexgenoten
Registered User
 
Industry Role:
Join Date: Dec 2010
Posts: 85
I'd start by seperating your scripting layer from you presentation layer.

Perhaps using a ''switch" could help you as well.

Quote:
$var = 'dog';

switch( $var ){
case 'dog':
echo "woef woef";
break;

case 'cat':
echo "miauw";
break;

default:
echo "no cat or dog found";

}

Last edited by Sexgenoten; 01-02-2011 at 08:57 AM..
Sexgenoten is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2011, 11:37 AM   #7
bl4h
Confirmed User
 
Join Date: Jul 2006
Location: Philadelphia
Posts: 1,282
wtf ? am I missing something here


Code:
if($this->product->productType == "dog" || $this->product->productType == "cat") { }
the two pipes between them means "OR".

|| = OR
&& = AND

I mean I wouldnt do it that way but that answer your question about and and or.
bl4h is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2011, 12:06 PM   #8
Adultlexicon
Confirmed User
 
Adultlexicon's Avatar
 
Join Date: Aug 2003
Location: Netherlands
Posts: 816
Check PHP.net its full of examples
Adultlexicon is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-02-2011, 02:06 PM   #9
r0bman
Confirmed User
 
r0bman's Avatar
 
Industry Role:
Join Date: Sep 2010
Posts: 38
Quote:
Originally Posted by bl4h View Post
wtf ? am I missing something here


Code:
if($this->product->productType == "dog" || $this->product->productType == "cat") { }
the two pipes between them means "OR".

|| = OR
&& = AND

I mean I wouldnt do it that way but that answer your question about and and or.
This is the correct way unless you are comparing more than a few product types (Cat, Dog, Horse, Pig) If so, use the switch statement.
r0bman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.