Customization > Custom Coding

Page in PHP page

(1/1)

solarsailor:
Hello, people!
I have some little question.
Sorry for my english and 'amazing' php knowledge  ;)

I need to put one page to another, like [SiNaN] made it for blocks.

My site has 2 languages. I want to make About-page, but with changeable content inside. If user switch language to english - About-page will be in english too.

So, as i understand, i need to make two BBC pages: aboutEN (with english text) and aboutRU (with russian text). Then i need a php page with code like this:


--- Code: ---global $context;

if ($context['user']['language'] == 'russian-utf8')
// output russian page

if ($context['user']['language'] == 'english')
// output english page

--- End code ---

What code should i put after IF condition to display the page i need?

emanuele:
It may be easier to do just one PHP page and:

--- Code: ---global $context;
$about_page = array(
    'english' => 'This is the content of the about page in English',
    'russian-utf8' => 'This is the content of the about page in Russian'
);

if (isset($about_page[$context['user']['language']]))
{
    $about_language = $context['user']['language'];
}
else
{
    $about_language = 'english';
}

echo parse_bbc($about_page[$about_language]);

--- End code ---

solarsailor:
Thank you so much!

Navigation

[0] Message Index

Go to full version