Greetings!
I'm trying to make a page that will be translated into the right language when language is selected. I've managed to do this in pages without tables, but when I add som tables it all go wrong. There is no error-message, it just wont work, so I guess I'm missing something in the code. In my code I have added {WELCOME_TXT} as shown in the code below. This is linked (I think) to my language file which code is shown at bottom.
When the page is loaded in my browser i just get the {WELCOME_TXT} written, and not the intended text....
Can anyone see what I have done wrong here?
Regards, Morten
<?php
define('IN_COPPERMINE', true);
define('WELCOME_PHP', true);
global $CONFIG;
require('include/init.inc.php');
pageheader('mbvfoto.net');
// your actual page content starts here
//HTML template for welcome page
$template_welcome_page=<<<EOT
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="27" height="32"></td>
<td width="479"></td>
<td width="218"></td>
<td width="15"></td>
<td width="326"> </td>
<td width="15"> </td>
<td width="77"> </td>
</tr>
<tr>
<td height="18"></td>
<td rowspan="6" valign="top">{WELCOME_TXT}
<p>This page is under construction </p>
<p> </p> <p>Please come back later</p>
<td rowspan="6" valign="top"><!--DWLayoutEmptyCell--> </td>
<td rowspan="5" valign="top" bgcolor="#636e5f"><!--DWLayoutEmptyCell--> </td>
<td valign="top" bgcolor="#636e5f"><blockquote>
<p><span class="style3">Aktuelle utstillinger </span></p>
</blockquote></td>
<td rowspan="5" valign="top" bgcolor="#636e5f"><!--DWLayoutEmptyCell--> </td>
<td></td>
</tr>
<tr>
<td height="125"> </td>
<td valign="top"><a href="bindex.php"><img src="http://localhost/cpm_test/themes/mbv_test/images/boraunen.gif" width="326" height="125"></a></td>
<td> </td>
</tr>
<tr>
<td height="43"></td>
<td valign="top" bgcolor="#636e5f" class="style3 style5"><p>Inneholder 9 bilder fra en aktiv stormvoll utenfor Stavanger </p></td>
<td> </td>
</tr>
<tr>
<td height="131"> </td>
<td valign="top" bgcolor="#636e5f"><!--DWLayoutEmptyCell--> </td>
<td> </td>
</tr>
<tr>
<td height="47"> </td>
<td valign="top" bgcolor="#636e5f"><!--DWLayoutEmptyCell--> </td>
<td> </td>
</tr>
<tr>
<td height="204"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
EOT;
print $template_welcome_page;
$param = array(
'{WELCOME_TXT}' => $lang_welcome_data['welcome_txt'],
);
?>
<?php
endtable();
// your actual page content ends here
pagefooter();
ob_end_flush();
?>
In my english.php is the code:
// --------------------------------------------------------------------------------- //
// File welcome.php
// --------------------------------------------------------------------------------- //
if (defined('WELCOME_PHP')) $lang_welcome_data = array(
'welcome_txt' => 'Welcome to my online gallery',
);
You need to use this code to parse the {} in the template. Add it after you define the $param array.
echo template_eval($template_welcome_page, $param);
You haven't parsed the $template_welcome_page string. All you're doing is printing out the string. You have to set your array, then parse the string. That's a lot more work than you need to do.
Try this:
<?php
define('IN_COPPERMINE', true);
define('WELCOME_PHP', true);
global $CONFIG;
require('include/init.inc.php');
pageheader('mbvfoto.net');
// your actual page content starts here
//HTML template for welcome page
echo '<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="27" height="32"></td>
<td width="479"></td>
<td width="218"></td>
<td width="15"></td>
<td width="326"> </td>
<td width="15"> </td>
<td width="77"> </td>
</tr>
<tr>
<td height="18"></td>
<td rowspan="6" valign="top">', $lang_welcome_data['welcome_txt'], '
<p>This page is under construction</p>
<p> </p>
<p>Please come back later</p>
</td>
<td rowspan="6" valign="top"><!--DWLayoutEmptyCell--> </td>
<td rowspan="5" valign="top" bgcolor="#636E5F">
<!--DWLayoutEmptyCell--> </td>
<td valign="top" bgcolor="#636E5F">
<blockquote>
<p><span class="style3">Aktuelle utstillinger</span></p>
</blockquote>
</td>
<td rowspan="5" valign="top" bgcolor="#636E5F">
<!--DWLayoutEmptyCell--> </td>
<td></td>
</tr>
<tr>
<td height="125"> </td>
<td valign="top"><a href="bindex.php"><img src=
"http://localhost/cpm_test/themes/mbv_test/images/boraunen.gif"
width="326" height="125" alt=""></a></td>
<td> </td>
</tr>
<tr>
<td height="43"></td>
<td valign="top" bgcolor="#636E5F" class="style3 style5">
<p>Inneholder 9 bilder fra en aktiv stormvoll utenfor
Stavanger</p>
</td>
<td> </td>
</tr>
<tr>
<td height="131"> </td>
<td valign="top" bgcolor="#636E5F">
<!--DWLayoutEmptyCell--> </td>
<td> </td>
</tr>
<tr>
<td height="47"> </td>
<td valign="top" bgcolor="#636E5F">
<!--DWLayoutEmptyCell--> </td>
<td> </td>
</tr>
<tr>
<td height="204"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>';
endtable();
// your actual page content ends here
pagefooter();
?>
It also seems like you are going to a lot of trouble to output something so simple. Please post a screenshot of what you want this to look like - I'm sure there's a much easier way to get what you're looking for.
Hi all. Thanks for your answers! Kegobeer, I know I'm moving into this ice on this one, if you know of an easier way, you'd make me a happy man if you let me know. A screenshot is provided below.
Basically what I want is to have a couple of image links on the right side and text on the left side that will change wether you choose english or norwegian..
thanks
Morten
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mbvfoto.net%2Fcpg132%2Falbums%2Fuserpics%2F10001%2Ffrontpage.jpg&hash=1824fca8f66339848d1301794f07834eaa9dc36b)
Yep, there's a much easier way - I'll code it when I get a chance.
Thanks Kegobeer! You're my hero!
regards,
Morten