different output depending on folder name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maraa
    New Member
    • Jan 2010
    • 3

    different output depending on folder name

    Hi,
    I am working on a website (set-up in Wordpress) in 5 languages, each language is in one folder: domain.com/en/, domain.com/es/ etc.

    Now I want for example in the sidebar and in the header to appear content depending on the language (=folder).

    For example: If I am on any page inside the folder ../en/, I want to show the site menu only with the sites in english, in the sidebar I want to show the links and Ads in english etc.

    My php knowledge is pretty limited, so I would be happy if somebody could help me with some advice.


    Thanks a lot!
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    if your language specific folder contains all necessary files, you can use relative path names and you shouldn’t have further problems to include headers, footers, sidebars, etc.

    Comment

    • maraa
      New Member
      • Jan 2010
      • 3

      #3
      Hi Dormilich, thanks for your reply.

      I am using Wordpress as a CMS for this website, so there ist no "real" folder structure, all the content is in the data base and the layout uses the same templates for all languages.
      So I have one sidebar file and one header file for the whole website. Within those files I need to put different content, depending on the language. How do I detect the language then?
      Some kind of function which checks if the current page URL contains the folder /en/, /es/, etc.
      "if the url contains /en/, show me sidebar content for /en/..."

      I hope you understand my idea?! ;-)

      Thanks for your help!

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        do you know, whether the URL is passed through mod_rewrite? (then you would probably have a variable with that value) maybe this is mentioned somewhere in the wordpress documentation.

        Comment

        • maraa
          New Member
          • Jan 2010
          • 3

          #5
          yes, the site is using mod_rewrite to rewrite the urls. how can i get a variable out of that?

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            that must be mentioned in the documentation. otherwise, if you have access to the .htaccess file (which I doubt), you could look it up there.

            Comment

            Working...