{}--tags not working properly, code error? {}--tags not working properly, code error?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

{}--tags not working properly, code error?

Started by mortenva, September 11, 2005, 06:28:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mortenva

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">&nbsp;</td>
    <td width="15">&nbsp;</td>
    <td width="77">&nbsp;</td>
  </tr>
  <tr>
    <td height="18"></td>
    <td rowspan="6" valign="top">{WELCOME_TXT}   
<p>This page is under construction </p>         
<p>&nbsp;</p>      <p>Please come back later</p>        
    <td rowspan="6" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    <td rowspan="5" valign="top" bgcolor="#636e5f"><!--DWLayoutEmptyCell-->&nbsp;</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-->&nbsp;</td>
    <td></td>
  </tr>
  <tr>
    <td height="125">&nbsp;</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>&nbsp;</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>&nbsp;</td>
  </tr>
  <tr>
   <td height="131">&nbsp;</td>
    <td valign="top"  bgcolor="#636e5f"><!--DWLayoutEmptyCell-->&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="47">&nbsp;</td>
    <td valign="top"  bgcolor="#636e5f"><!--DWLayoutEmptyCell-->&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="204">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
   <td>&nbsp;</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',
);


Nibbler

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);

kegobeer

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">&nbsp;</td>
<td width="15">&nbsp;</td>
<td width="77">&nbsp;</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>&nbsp;</p>
<p>Please come back later</p>
</td>
<td rowspan="6" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td rowspan="5" valign="top" bgcolor="#636E5F">
<!--DWLayoutEmptyCell-->&nbsp;</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-->&nbsp;</td>
<td></td>
</tr>
<tr>
<td height="125">&nbsp;</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>&nbsp;</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>&nbsp;</td>
</tr>
<tr>
<td height="131">&nbsp;</td>
<td valign="top" bgcolor="#636E5F">
<!--DWLayoutEmptyCell-->&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="47">&nbsp;</td>
<td valign="top" bgcolor="#636E5F">
<!--DWLayoutEmptyCell-->&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="204">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>'
;

endtable();
// your actual page content ends here
pagefooter();
?>
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

kegobeer

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.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

mortenva

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)

kegobeer

Yep, there's a much easier way - I'll code it when I get a chance.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

mortenva

Thanks Kegobeer! You're my hero!


regards,
Morten