Solved

Include file conditional

Posted on 2013-10-28
5
212 Views
Last Modified: 2013-11-02
Hi,

I need to include a file depending of the language of the page defined by url.

It's working ok for welcome page
index.php?page=welcome&lang=_en

but it's not working on other pages like
index.php?page=services&lang=_en

Here is the code

<?php 
if($page == "welcome" && ( $lang == "_en" || $lang == "") )
{
 
     include('jbar.php');
   
}
elseif($page == "welcome" && $lang == "_fr")
{

     include('jbar_fr.php');
    
}
?>

Open in new window


Thanks
0
Comment
Question by:lenamtl
  • 3
5 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 39607416
You're not checking for any other page than 'welcome'.
0
 
LVL 24

Author Comment

by:lenamtl
ID: 39607432
How can I check also other pages that end by _fr or _en
I have only 10 pages per language
0
 
LVL 24

Accepted Solution

by:
lenamtl earned 0 total points
ID: 39607438
I will add them manually like this "welcome" || "services"  

if($page == "welcome" || "services"  && ( $lang == "_en" || $lang == "") )
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39607458
0
 
LVL 24

Author Closing Comment

by:lenamtl
ID: 39618574
I have found myself the complete solution
Other expert point the problem so this is why I want to awarded him the point
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now