Author Topic: [MOD] Multi-Language support for any text (updated 05-11-2005)  (Read 215718 times)

0 Members and 1 Guest are viewing this topic.

TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #60 on: September 15, 2005, 06:25:39 PM »
Quote

What about the Mod


Yes ... what about it ?

Quote

But the random image an the newest on homepage are still not working.


Specifics please.

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD] Multi-Language support for any text
« Reply #61 on: September 15, 2005, 06:33:39 PM »
First, just one small problem with the link to details.php in the mod newest picture on homepage

echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";

The URL to the details page is wrong.
The URL is like  root_path/script url/details.php
root_path or script url one is enough.

My problem with the random image Mod outside 4images is the same as with the newest images Mod
The multilang image_name is not shown in the right way but like this  Wasser[english]water

Matthias

TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #62 on: September 15, 2005, 06:49:14 PM »
Quote

echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";


Correct. Which is why, you must

replace :

Quote

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES', 1);
define('SCRIPT_URL', 'http://www.gpaed.de/bildergalerie/');
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();


with :

Code: [Select]

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES', 1);
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();


and use the SCRIPT_URL from your includes/constants.php file since the definition is already detected from your global.php file since global.php is included in this file as well. ;)

Quote

The multilang image_name is not shown in the right way but like this  Wasser[english]water


Ah ! now I see.

Ok, so let's do this.

Code: [Select]

<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.0 for 4images 1.6.1                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
 *    weitere Informationen.                                              *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
 *    information.                                                        *
 *                                                                        *
 *************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES'1);
define('ROOT_PATH''/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE'1);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL."
        "
;

$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments 
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL.
        LIMIT 
$number, 1";

$row $site_db->query_firstrow($sql);

$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name multilang($row['image_name']);
$image_comments $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo 
"<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"".$image_name."\"></a>\n"
echo "<b>".$image_name."</b><br>\n";
echo 
$lang['comments'] . REPLACE_EMPTY $image_comments."<br>\n";
unset (
$number);

?>



Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD] Multi-Language support for any text
« Reply #63 on: September 15, 2005, 07:03:28 PM »
Correct. Which is why, you must

replace :

Quote

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES', 1);
define('SCRIPT_URL', 'http://www.gpaed.de/bildergalerie/');
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();


with :

Code: [Select]

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES', 1);
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();


and use the SCRIPT_URL from your includes/constants.php file since the definition is already detected from your global.php file since global.php is included in this file as well. ;)

That did not work.
I changed in the path to details php the ROOT_PATH with the SCRIPT_PATH
so my php-file Newest Image outside 4images looks like this

Code: [Select]
<?php
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES'1);
define('SCRIPT_URL''http://www.gpaed.de/bildergalerie/');
define('ROOT_PATH''/www/htdocs/v030672/bildergalerie/');
define('GET_USER_ONLINE'1);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_hits
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat="
.AUTH_ALL."
        AND b.auth_viewimage="
.AUTH_ALL."
        ORDER BY image_date DESC
        LIMIT 3"
;
$result $site_db->query($sql);
while (
$row $site_db->fetch_array($result)) {
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name multilang($row['image_name']);
$image_hits $row['image_hits'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
echo 
"<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo 
"<br><b>".$image_name."</b><br>\n";
echo 
$lang['hits'] . REPLACE_EMPTY $image_hits."<br><br>\n";
}
?>

Again, Thank you very much for your help, TheOracle
Now I'm trying your code suggestion for random image
Matthias




TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #64 on: September 15, 2005, 07:09:21 PM »
Quote

Now I'm trying your code suggestion for random image


Sure, let me know how it goes. ;)

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD] Multi-Language support for any text
« Reply #65 on: September 15, 2005, 07:10:42 PM »
Hm your code suggestion for random image sent me back the following error

Quote
Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in /www/htdocs/******/random.php on line 66

Matthias

TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #66 on: September 15, 2005, 07:26:05 PM »
Uncomment this line :

Quote

echo $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


to see if the error will show again. If not, then I might have the answer on why it returns a T_ECHO error message.

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD] Multi-Language support for any text
« Reply #67 on: September 15, 2005, 07:30:14 PM »
Uncomment this line :

Quote

echo $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


to see if the error will show again. If not, then I might have the answer on why it returns a T_ECHO error message.


The error is the same
Matthias

TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #68 on: September 15, 2005, 07:36:09 PM »
Ok, then,

replace :

Quote

echo $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


with :

Code: [Select]

$msg = $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD] Multi-Language support for any text
« Reply #69 on: September 15, 2005, 07:52:58 PM »
Ok, then,

replace :

Quote

echo $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


with :

Code: [Select]

$msg = $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


There is still this error
Quote
Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in /www/htdocs/******/random.php on line 66

 :(

TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #70 on: September 15, 2005, 07:54:36 PM »
Are you sure you're working on the same file ?

If so,

change :

Quote

echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";


replace with :

Code: [Select]

/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/


Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD] Multi-Language support for any text
« Reply #71 on: September 15, 2005, 08:02:17 PM »
Are you sure you're working on the same file ?

If so,

change :

Quote

echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";


replace with :

Code: [Select]

/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/


Now that's the error message
Quote
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/******/index.php:4) in /www/htdocs/******/bildergalerie/includes/sessions.php on line 79

my file looks now like this
Code: [Select]
<?php
/**************************************************************************
*                                                                        *
*    4images - A Web Based Image Gallery Management System               *
*    ----------------------------------------------------------------    *
*                                                                        *
*             File: random.php                                           *
*        Copyright: (C) 2002 Jan Sorgalla                                *
*            Email: jan@4homepages.de                                    *
*              Web: http://www.4homepages.de                             *
*    Scriptversion: 1.0 for 4images 1.6.1                                *
*                                                                        *
*    Never released without support from: Nicky (http://www.nicky.net)   *
*                                                                        *
**************************************************************************
*                                                                        *
*    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
*    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
*    weitere Informationen.                                              *
*    ---------------------------------------------------------------     *
*    This script is NOT freeware! Please read the Copyright Notice       *
*    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
*    information.                                                        *
*                                                                        *
*************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES'1);
define('ROOT_PATH''/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE'1);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL."
        "
;

$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments 
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL.
        LIMIT 
$number, 1";

$row $site_db->query_firstrow($sql);

$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name multilang($row['image_name']);
$image_comments $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/
unset ($number);

?>


TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #72 on: September 15, 2005, 08:08:27 PM »
Too much spaces :

Quote

$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/
unset ($number);

?>


replace with :

Code: [Select]

$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/
unset ($number);
?>


Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD] Multi-Language support for any text
« Reply #73 on: September 15, 2005, 08:15:09 PM »
No error anymore, but when I comment the uncommented line (o god my english), there is no thumbnail and the path is like this
http://www.gpaed.de/SCRIPT_URLdetails.php?image_id=184

Matthias

TheOracle

  • Guest
Re: [MOD] Multi-Language support for any text
« Reply #74 on: September 15, 2005, 08:20:03 PM »
Quote

http://www.gpaed.de/SCRIPT_URLdetails.php?image_id=184


Well, I mentionned earlier not to use the SCRIPT_URL since your global.php file includes all these instances already - including constants.php file. ;)

Meaning,

by replacing :

Quote

echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";


with :

Code: [Select]

echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";


it has to work.