quinta-feira, 25 de outubro de 2007

Passing PHP vars by parameter to Javascript functions

Usually PHP programmers need to build dynamic systems like scrools , random text , image galleries ...
First time i tryed to build some php features using javascript i faced some problems using php and javascript, concretely passing php variables to javascript fucntions by parameter.
On this article i´ll teach how i solve this problem.
First we will declare an JavaScript function . Let´s use the simple example above.

The function must be added between the tags head on the html code

Check how to add php code as parameters on javascript functions

And it´s done


Visit my php web site at www.revista-php.net , and add your questions

Regards

sexta-feira, 19 de outubro de 2007

Detecting resolution with javascript

Here is a simple javascript function to detect your screen resolution.
With this you are able to build your web sites correctly working on all available resolutions

On this function i ´ll apply some features to an css box , and formating them using style properties.

Regards ;)

quinta-feira, 18 de outubro de 2007

How to load two ore more javascript functions

Here is a simple answer to a question sended to my email box

"How do i call two or more javascript functions on HTML ? "

here is the solution




where functionx1  and functionx2  are you javascript functions defined between the tags








Great programming ;)

terça-feira, 16 de outubro de 2007

Solving the problem of getting MySQL last id


I was studing a few of mysql to a project of mine , and i realize there arlots of people that has this doubt .

How to get the last id from a MySQL table. Follows the ansewer :)

Here is how to use this function




Hope it can help you

Regards ;)

PHP ADVANCED :: The Singleton Design Pattern

Design Patterns , usually the GOF (gang of four) technics , are used to solve current problems on software modelling , generally on software engineering cases.
On this article i´ll tell you how to use Singleton Patterns on PHP, on current version PHP5.
This patterns is used when you can use just one single instance of the class you declared, and with it have an active instance without losing the link resource.
An example very useful is what happens on database connections , where , with just one instance you are able to make to rest of operations you need to.
The main properties to work on Singleton with PHP5 , are the private and static properties.
Understand his use are extremly important to build a good Singleton class code.
On the example right next , i´ll will build a simple class to use mysql and msqli according the project settings.


.... this article is beeing written, please stand by

segunda-feira, 1 de outubro de 2007



I ´m very proud to announce the edition of first PHP magazine here in Portugal.
November will be out. This release will have only e-magazine version, but we are thinking on a printable version after.
Project will have collaboration of some prestidigitate PHP programmers as Manuel Lemos (PHP CLasses), José Fonseca (Yahoo UK), Zendrael (Anubis), Pablo dall Óglio (Tulip and Agata)... and a few more


Here goes the magazine cover for the next mount