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 06-14-2022, 01:26 PM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 771
If statement problem :(

Quote:
<?php if($website) { ?><a href="http://<?php echo $website; ?>" target="<?php echo $name; ?>"><?php echo $name; ?></a><?php } ?>
Any idea why this is removing the $name field completely in addition to the link?

All Im trying to get it to do is still display the name, just remove the href link if no website is included in the DB
__________________
DMCASUITE
BETA Testers Needed.
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-14-2022, 01:34 PM   #2
redwhiteandblue
Bollocks
 
redwhiteandblue's Avatar
 
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,792
Because if the condition in the if statement is false, none of the code inside the curly braces will execute.
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-14-2022, 01:35 PM   #3
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 771
Quote:
Originally Posted by redwhiteandblue View Post
Because if the condition in the if statement is false, none of the code inside the curly braces will execute.
Gotcha, thank you!
__________________
DMCASUITE
BETA Testers Needed.
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-14-2022, 01:37 PM   #4
redwhiteandblue
Bollocks
 
redwhiteandblue's Avatar
 
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,792
BTW, rather than writing
Code:
<?php echo $website; ?>
you can shorten this to
Code:
<?=$website;?>
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-14-2022, 01:43 PM   #5
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 771
Quote:
Originally Posted by redwhiteandblue View Post
BTW, rather than writing
Code:
<?php echo $website; ?>
you can shorten this to
Code:
<?=$website;?>
Good to know!

I was actually going to post in a few weeks to see where I could shorten some of the code I'm using on my admin system and I'm sure its over-inflated, but I need to get things finished up with it first.
__________________
DMCASUITE
BETA Testers Needed.
Publisher Bucks is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-14-2022, 02:20 PM   #6
sarettah
I'll make you famous
 
Industry Role:
Join Date: Oct 2002
Posts: 13,947
Be careful using short codes. They require an ini setting that is not always turned on. So code that works on one server may not work on another.

It can also lead to some issues when dealing with xml which also uses an <? ?> Syntax.

.
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-14-2022, 03:47 PM   #7
redwhiteandblue
Bollocks
 
redwhiteandblue's Avatar
 
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,792
Quote:
Originally Posted by sarettah View Post
Be careful using short codes. They require an ini setting that is not always turned on. So code that works on one server may not work on another.

It can also lead to some issues when dealing with xml which also uses an <? ?> Syntax.

.
You're talking about short open tags - <? ... ?> which are possibly being deprecated.

The short echo tags <?= ... ?> are not dependent on an ini setting https://www.php.net/manual/en/langua...ax.phptags.php and there's no proposal to deprecate them.
They are actually line 1 of the PSR-1 coding standard https://www.php-fig.org/psr/psr-1/

Not that anyone actually follows that...
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-14-2022, 04:04 PM   #8
sarettah
I'll make you famous
 
Industry Role:
Join Date: Oct 2002
Posts: 13,947
Quote:
Originally Posted by redwhiteandblue View Post
You're talking about short open tags - <? ... ?> which are possibly being deprecated.

The short echo tags <?= ... ?> are not dependent on an ini setting https://www.php.net/manual/en/langua...ax.phptags.php and there's no proposal to deprecate them.
They are actually line 1 of the PSR-1 coding standard https://www.php-fig.org/psr/psr-1/

Not that anyone actually follows that...



Interdasting. I learn something new about every 2 minutes.

Thanks for that.

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

Tags
statement



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.