?
Solved

How to show/Hide html element on cpecific URL

Posted on 2011-10-05
10
Medium Priority
?
409 Views
Last Modified: 2012-05-12
Hello experts,

I have a website that contains schedule system. There is two schedules for two offices
Schedule one:
http://corpus.pickup.org.il/index.php?option=com_shedule&filial_id=1&Itemid=226
Schedule 2
http://corpus.pickup.org.il/index.php?option=com_shedule&filial_id=2&Itemid=221

The only difference in url is "filial_id" it can be 1 or 2

Now my question:
I need to show div with different image for each one of schedules.
On  schedule one "img one" on schedule two "image two"
How can i show div with image only if url is valid for relevant element
example:

http://corpus.pickup.org.il/index.php?option=com_shedule&filial_id=1&Itemid=226
show image one
http://corpus.pickup.org.il/index.php?option=com_shedule&filial_id=2&Itemid=221
show image two.

Thank you,
Dan
0
Comment
Question by:DanSmir
  • 5
  • 5
10 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36918396
There will be a variable in the PHP global scope called $_GET.  It is an array.  Test $_GET["filial_id"] with an if() statement and use the result to choose which image to produce.
0
 

Author Comment

by:DanSmir
ID: 36918573
Dear ray,
Can you please provide full code?

Thank you
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36918616
No, but I can show you an example.  Back in a moment
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:DanSmir
ID: 36918623
Ok, show me
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 36918710
See these two links:
http://www.laprbass.com/RAY_temp_dansmir.php?option=com_shedule&filial_id=1&Itemid=226
http://www.laprbass.com/RAY_temp_dansmir.php?option=com_shedule&filial_id=2&Itemid=221

HTH, ~Ray
<?php // RAY_temp_dansmir.php
error_reporting(E_ALL);

/* FROM THE POST AT EE
http://corpus.pickup.org.il/index.php?option=com_shedule&filial_id=1&Itemid=226
show image one
http://corpus.pickup.org.il/index.php?option=com_shedule&filial_id=2&Itemid=221
show image two.
*/

// GET THE INFORMATION FROM THE URL ARGUMENT USING THE TERNARY OPERATOR
// MAN PAGE http://php.net/manual/en/language.operators.comparison.php
$filial_id = isset($_GET["filial_id"]) ? $_GET["filial_id"] : 0;

// USE SWITCH-CASE NOTATION TO CHOOSE INFORMATION
// MAN PAGE http://php.net/manual/en/control-structures.switch.php
switch ($filial_id)
{
    case 1:
        echo "<br/>filial_id = 1";
        echo "<br/>Itemid = {$_GET["Itemid"]}";
        break;

    case 2:
        echo "<br/>filial_id = 2";
        echo "<br/>Itemid = {$_GET["Itemid"]}";
        break;

    default:
        echo "<br/>filial_id IS NOT UNDERSTOOD";
        break;
}

Open in new window

0
 

Author Closing Comment

by:DanSmir
ID: 36918755
Genius!!
Thank you very much:)))
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36918939
Thanks for the points! ~Ray
0
 

Author Comment

by:DanSmir
ID: 36918964
BTW Ray,

What for this "error_reporting(E_ALL);"?
0
 

Author Comment

by:DanSmir
ID: 36918976
To Ray, i got it.

Thanks again
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36920620
10-4.  All the best, ~Ray
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

840 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