Advanced search  

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

Pages: [1]   Go Down

Author Topic: {}--tags not working properly, code error?  (Read 3795 times)

0 Members and 1 Guest are viewing this topic.

mortenva

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
{}--tags not working properly, code error?
« on: September 11, 2005, 06:28:19 pm »

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


Code: [Select]
<?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:



Code: [Select]
// --------------------------------------------------------------------------------- //
// File welcome.php
// --------------------------------------------------------------------------------- //

if (defined('WELCOME_PHP')) $lang_welcome_data = array(
'welcome_txt' => 'Welcome to my online gallery',
);

Logged

Nibbler

  • Guest
Re: {}--tags not working properly, code error?
« Reply #1 on: September 11, 2005, 08:10:29 pm »

You need to use this code to parse the {} in the template. Add it after you define the $param array.

Code: [Select]
echo template_eval($template_welcome_page, $param);
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: {}--tags not working properly, code error?
« Reply #2 on: September 11, 2005, 08:16:33 pm »

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:

Code: [Select]
<?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();
?>
Logged
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

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: {}--tags not working properly, code error?
« Reply #3 on: September 11, 2005, 08:23:33 pm »

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.
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: {}--tags not working properly, code error?
« Reply #4 on: September 12, 2005, 07:54:35 am »

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://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.mbvfoto.net%2Fcpg132%2Falbums%2Fuserpics%2F10001%2Ffrontpage.jpg&hash=1824fca8f66339848d1301794f07834eaa9dc36b)
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: {}--tags not working properly, code error?
« Reply #5 on: September 12, 2005, 02:02:25 pm »

Yep, there's a much easier way - I'll code it when I get a chance.
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: {}--tags not working properly, code error?
« Reply #6 on: September 12, 2005, 06:59:42 pm »

Thanks Kegobeer! You're my hero!


regards,
Morten
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.