Solved

Include file conditional

Posted on 2013-10-28
5
218 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 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 25

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 25

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 110

Expert Comment

by:Ray Paseur
ID: 39607458
0
 
LVL 25

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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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 …

724 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