Solved

Include file conditional

Posted on 2013-10-28
5
210 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 82

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

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

747 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

12 Experts available now in Live!

Get 1:1 Help Now