Page 1 of 1

very freaky echo() statement

Posted: Fri Jan 07, 2005 2:58 pm
by Red Squirrel

Code: Select all

echo html_tag( 'table',
    html_tag( 'tr',
        html_tag( 'td',
            '<center>'.
            ( isset($org_logo) && $org_logo
              ? '<img src="' . $org_logo . '" alt="' .
                sprintf(_("%s Logo"), $org_name) .'"' . $width_and_height .
                ' />
' . "
"
              : '' ).
            ( (isset($hide_sm_attributions) && $hide_sm_attributions) ? '' :
            '<small>' . sprintf (_("<h2><a href="../../email.htm">Main</a></h2>SquirrelMail version %s"), $version) . '
' ."
".
            '  ' . _("By the SquirrelMail Development Team") . '
</small>' . "
" ) .
            html_tag( 'table',
                html_tag( 'tr',
                    html_tag( 'td',
                        '<b>' . sprintf (_("%s Login"), $org_name) . "</b>
",
                    'center', '#DCDCDC' )
                ) .
                html_tag( 'tr',
                    html_tag( 'td',  "
" .
                        html_tag( 'table',
                            html_tag( 'tr',
                                html_tag( 'td',
                                    _("Name:") ,
                                'right', '', 'width="30%"' ) .
                                html_tag( 'td',
                                    addInput($username_form_name, $loginname_value),
                                'left', '', 'width="*"' )
                                                                ) . "
" .
                            html_tag( 'tr',
                                html_tag( 'td',
                                    _("Password:") ,
                                'right', '', 'width="30%"' ) .
                                html_tag( 'td',
                                    addPwField($password_form_name,$loginpass_value).
                                    addHidden('js_autodetect_results', SMPREF_JS_OFF).
                                    addHidden('just_logged_in', '1'),
                                'left', '', 'width="*"' )
                            ) ,
                        'center', '#ffffff', 'border="0" width="100%"' ) ,
                    'left', '#FFFFFF' )
                ) . 
                html_tag( 'tr',
                    html_tag( 'td',
                        '<center>'. addSubmit(_("Login")) .'</center>',
                    'left' )
                ),
            '', '#ffffff', 'border="0" width="350"' ) . '</center>',
        'center' )
    ) ,
'', '#ffffff', 'border="0" cellspacing="0" cellpadding="0" width="100%"' );
[code]

Don't you think it would be easier for them to just have used normal html, instead of html functions to produce it?  Wow I had to edit some of that code and it was quite the thing.  :roflmao2: 

And no this is not a script I made even though it's called squirrelmail.  I do nest functions allot when coding, but not to this extent. :lol: 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:2986, old post ID:24494[/size][/color]

very freaky echo() statement

Posted: Fri Jan 07, 2005 3:29 pm
by wtd
They could have at least used a heredoc.

Archived topic from Iceteks, old topic ID:2986, old post ID:24496

very freaky echo() statement

Posted: Fri Jan 07, 2005 3:45 pm
by Death
:o WOAH! That is crazy. There's a good example of unorganized programming. Wouldn't that be a biatch to debug?

Archived topic from Iceteks, old topic ID:2986, old post ID:24497

very freaky echo() statement

Posted: Fri Jan 07, 2005 4:37 pm
by Red Squirrel
Yep, I had to add a "value=" to a field... when I found out it was predefined functions I told myself.. "great". Thankfully those functions actually do support the value= part.

I think this is the line I had edited: addPwField($password_form_name,$loginpass_value)

Basically if I access the page using ?pass= it will put in the password, but it was not as easy as plugging in the $_GET var into value=. Took me like 20 minutes to figure out how to get my idea to work. I was going to just rewrite the html using a single echo. Having seperate functions like that is not really needed.

Archived topic from Iceteks, old topic ID:2986, old post ID:24502

very freaky echo() statement

Posted: Fri Jan 07, 2005 8:24 pm
by wtd
Errrmmm... why in the name of everything unholy would you echo HTML like that? The only thing even remotely appealing about PHP anyway is the ability to mix it with HTML seamlessly.

Code: Select all

<a href="http://yada.yada.com?val=<?= $_GET["some_var"] ?>">hello, world!</a>[code] 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:2986, old post ID:24504[/size][/color]

very freaky echo() statement

Posted: Fri Jan 07, 2005 9:26 pm
by Red Squirrel
Yeah I don't know why people do that. It's considered invalid, but it does work in some versions of php.

Archived topic from Iceteks, old topic ID:2986, old post ID:24507