Include file conditional

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
LVL 28
lenamtlAsked:
Who is Participating?
 
lenamtlConnect With a Mentor Author Commented:
I will add them manually like this "welcome" || "services"  

if($page == "welcome" || "services"  && ( $lang == "_en" || $lang == "") )
0
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
You're not checking for any other page than 'welcome'.
0
 
lenamtlAuthor Commented:
How can I check also other pages that end by _fr or _en
I have only 10 pages per language
0
 
lenamtlAuthor Commented:
I have found myself the complete solution
Other expert point the problem so this is why I want to awarded him the point
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.