Page 1 of 1

Where to put own functions and how to call them?

Posted: Wed 11. Jul 2007, 14:02
by Matrim
Hello,

even the most perfect wcms cannot cover all the special needs one person could have. So for this reason one can write its own php functions and include them.

I know a way to call these functions by creating replacement tags and place the files which parse the content and have the necesarry function under /template/inc_script/frontend_render ...

But I realize the functions located there are loaded every time a page is shown. I guess there is a better way. Where to store those files and how to include them? E.g. in an article?

Thank you in advance.

Posted: Wed 11. Jul 2007, 15:17
by update
Do you mean like this:

Code: Select all

[PHP]include("loadit.php");[/PHP]
If yes, you can use any everywhere you want... :?:
claus

Posted: Wed 11. Jul 2007, 21:17
by DeXXus

Code: Select all

{PHP:my_external_PHP_script.php}

Use:  This tag supports complete external php scripts, ending with the *.php suffix. Phpwcms buffers output to enable these scripts to execute. Very robust including connections to remote databases. See forum for details and usage. 

Posted: Thu 12. Jul 2007, 09:43
by update
Thank you Dexxus,
this helped solving my little php problem in http://www.phpwcms.de/forum/viewtopic.php?p=89200#89200

claus

Posted: Fri 24. Aug 2007, 13:20
by juergen
@claus:

This would mean your probs are gone after settling out your script from [PHP] to external {PHP:...} :?:

Posted: Fri 24. Aug 2007, 14:58
by update
YES SIR :D
I've described it here
http://www.phpwcms.de/forum/viewtopic.php?p=89200#89200
claus

Posted: Fri 24. Aug 2007, 16:59
by juergen
hmmmm.... Thte reason why ... I'm asking that exact:

I handle a database on the ds5000 etch server with [PHP]...
No Pooblems with the extra database inside phpwcms, there are several tables with a million entries each, only problem are German umlauts


:roll:

hmmmm.... and it is INSIDE Frontend login.... you know why I think before {PHP:4erveryone.php} ... :?:

Posted: Fri 24. Aug 2007, 18:52
by update
My very problem has been the following:
my db / conf.inc.php is utf-8
the php file pulled off of another server is something like iso...
when pulling it without options it arrived with the wrong charset because phpwcms did a rewrite into utf-8
so I tried to force it to be ISO-8859-1 even after the include...
its works...!
Only glitch seems to be that the particular page is changing to iso too - at least the content's title did so...

This works for just one page, not the following ones

Or did I get you wrong completely?

Posted: Sat 25. Aug 2007, 06:47
by juergen
hmm, thks claus ....

Nearly same here, but with db : The original databses was oracle running on windows. Still alive, being tranported to my server.

My etch system hs everything on utf-8, now the iso (swedish-ci) Table is in the site and som strange things happen:

Outside frontend: All ok, reload goes through and same evreytime. Inside: every 2nd reload mixes up the utf-8 Umlauts.

The first part of the ISO Part is displayed well inside (list abt. 1400 Entries for a customer)

From there next mask with a link, half displayd ok, next half "L�nge 3"

This drives me NUTS :D

There were definitly no problems with the second db, even with 14 Tables and 180 MB of extra data. Only Umlauts :shock: :roll:

I'll make you customer to have a look :?:


***********************
EDIT
**********************

Select Brain FROM df6ih where logic= true


this->problem solved ;)


reversed phpwcms tables to latin1, changed config data .. et voila :D

Posted: Sat 25. Aug 2007, 11:43
by update
reversed phpwcms tables to latin1, changed config data .. et voila
for me (and other) dummy: could you provide a short line of howto just in case I'll need this too some time? Thank you :oops:

PS: There indeed is a difference sometimes between the frontend display and the backend one - but both have utf-8 in their headers - :?:
Seems to be that the standard install of mysql is basically latin swedish :?: :?: But I don't know enough about the insights of dbs ... :?

PPS: !Select Brain FROM claus where logic= true :lol:

Posted: Sat 25. Aug 2007, 11:56
by juergen
Ok, so I tell you what I did, there are several ways as even all the times.. :
utf-8 to latin1 or back:

1.) I copied structure of all phpwcms tables in phpmyadmin as Text, copy pasted it in
2.) Text Editor, where I changed all utf8 into latin1
3.) This step needs more than 1 database: Created a new database
4.) in new database-> Sql all the changed stuff.
5.) Back to old database CSV for all table entries in phpwcms
6.) Copy paste into Sql Section of the new database.
7.) Ready

There are !! wrong Umlauts after this "attack", but in CSV you can change them...as I did with text editor in 4000 cases ;)

I took this method cause the reference database is left untouched on the server. I then changed the sql data in config file phpwcms .. and here we go.

For being shure this method went through, I can delete the old utf database.

//EDIT : Perhaps this all is possible with telnet, hmm :oops: I'm so glad thát this is ready, so I do not have to find out how :D

Posted: Sun 26. Aug 2007, 11:45
by Oliver Georgi
custom functions are best placed in template/inc_script/frontend_init or frontend_render - based on needs when to have function accessible. For usage inside inline PHP code use frontend_init.

Oliver