?
Solved

Include file conditional

Posted on 2013-10-28
5
Medium Priority
?
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 84

Assisted Solution

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

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 26

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 26

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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…
The viewer will learn how to dynamically set the form action using jQuery.
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 …
Suggested Courses

770 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