[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

if this domain name dont show it!

Posted on 2009-04-28
2
Medium Priority
?
241 Views
Last Modified: 2012-05-06
Hi all,

My programer is away on holiday and I really need to get this sorted so if anyone can help I would be very graitfull :)

I have this snipit

$images[] = '<div style="padding-bottom: 10px;"><a href="'.site_url('Insure_Car_Insurance').'"><img src="/public/images/insureleft.gif" alt="Car Insurance" border="0"></a></div>';

Now what I need to do is, if the site domain name is http://www.domainname.com do not show this image, but please show it to any other domain.

Please can anyone help

Thanks Paul
0
Comment
Question by:submissiontechnology
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
majkiw earned 1500 total points
ID: 24250135
You can test that using strpos($haystack, $needle), which returns index of needle in haystack. If not found -1 is returned.
So you can just write:


if(strpos(site_url('Insure_Car_Insurance'), 'http://www.domainname.com') == -1 ){
  $images[] = '<div style="padding-bottom: 10px;"><a href="'.site_url('Insure_Car_Insurance').'"><img src="/public/images/insureleft.gif" alt="Car Insurance" border="0"></a></div>';
}
else 
  $images[] = '';

Open in new window

0
 
LVL 2

Expert Comment

by:majkiw
ID: 24292940
So, did it work for you or isn't it what you needed?
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month20 days, 3 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question