You are here: Re: How to keep global strings in another file? « PHP Programming Language « IT news, forums, messages
Re: How to keep global strings in another file?

Posted by Floortje on 03/15/07 13:23

Sonnich schreef:
> Hi!
>
> I want to have a number of strings in another file, which I can
> include everywhere... but I cannot make them reachable from the top
> file. I have looked at var and global to to this but without luck.
> The idea is to have all text the same place, which minimses changes
> and spelling errors.
>
> something like error messages stored:
>
> <?
> $sError001="stupid user";
> $sError002="not available";
> ?>
>
> and then :
>
> include "errormsgs.php";
> echo $sError001;

This should work. You have another error. \

Btw set it up a little different. That way you can allways change ur
error code without redoing the same echo over and over again.

include('somefile');
showerror(1);

function showerror($no)
{
$errors=array(
1=>'wrong page',
2=>'hack attempt'
)

echo $errors[$no];
// do stuff here later
}

--
Arjen
http://www.hondenpage.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация