Autor Beitrag
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mo 27.06.05 19:13 
Moin... ;)

Wollte mal fragen, ob jemand von euch eine Art (in)offizielle Richtlinie für Styling von PHP/HTML-Dateien kennt. Also ähnlich dem hier für Delphi.

Z.B. würde mich interessieren, ob man jetzt " bei Strings verwendet oder doch '. Oder " und dann für HTML-Tag-Eigenschaften dann ein \" einsetzt.

Danke schonmal. :D

cu, WeBBy
direction4delphi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 84

WIN 95, WIN 98, WIN ME, WIN NT, WIN 2000, WIN XP, VISTA
D2 Prof, D4 Prof,D2005 Prof, Delphi4Php
BeitragVerfasst: Mo 27.06.05 20:26 
Das mit den " und ' ist schnell erklärt Also mal ganz einfach variablen werden in PhP mit $ gekennzeichnet innerhal der " werden diese interpretiert zB:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
<?php
$world="Welt";
echo "Hallo $world"; // Hallo Welt
//oder
echo 'Hallo $world'; // Hallo $world
?>

Des Weiteren müssen innerhalb " Sonderzeichen und Funktionszeichen escapted werden
Siehe auf [url]php.net[/url]

Eine Sytaxempfehlung wird Beispielsweise bei pear verwendet siehe [url]pear.php.net[/url]

mfg
MILLI
Meillo
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 97

Debian GNU/Linux
PHP, Ruby(-Newbie)
BeitragVerfasst: Mo 27.06.05 21:04 
hier die Konventionen von phpbb: area51.phpbb.com/doc...ding-guidelines.html

IMHO sollte man sich diverse Codeschnipsel anschauen, sich Gedanken machen und dann seinen eigenen Style entwickeln - solangen er in sich schlüssig ist und grob den gängigen Varianten entspricht.


nun noch konkret: möglichst die doppelten Anführungszeichen vermeiden und Einfache verwenden, es sei denn der Code wird dabei stark verkompliziert.

_________________
Dass es in FORTRAN keine strukturierten IF-, REPEAT...UNTIL- oder CASE- Statements gibt, braucht einen richtigen Programmierer nicht zu sorgen.
Nebenbei, man kann sie nötigenfalls durch zugewiesene GOTOs simulieren.
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 28.06.05 12:50 
user profile icondirection4delphi hat folgendes geschrieben:
Das mit den " und ' ist schnell erklärt Also mal ganz einfach variablen werden in PhP mit $ gekennzeichnet innerhal der " werden diese interpretiert [...]

Mhmm... Dann würde er auch keine "s in 's interpretieren? Gleich mal ausprobieren... :gruebel:

Danke auf jeden Fall für eure Antworten... Melde mich gleich wieder... ;)
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 28.06.05 13:00 
user profile iconWeBsPaCe hat folgendes geschrieben:
Mhmm... Dann würde er auch keine "s in 's interpretieren? Gleich mal ausprobieren... :gruebel:

Jawoll... Genau so ist's... :D

Vielen Dank für eure Antworten... ;)