[Site Home] [Forum Home] [Articles] [File DB] [News Archives]

Programming -> very freaky echo() statement


(View original topic)


Red Squirrel - Jan-07-2005 server time
Yeah I don't know why people do that. It's considered invalid, but it does work in some versions of php.

wtd - Jan-07-2005 server time
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
<a href="http://yada.yada.com?val=<?= $_GET["some_var"] ?>">hello, world!</a>

Red Squirrel - Jan-07-2005 server time
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.

Furball - Jan-07-2005 server time
ohmy.gif WOAH! That is crazy. There's a good example of unorganized programming. Wouldn't that be a biatch to debug?

wtd - Jan-07-2005 server time
They could have at least used a heredoc.

Red Squirrel - Jan-07-2005 server time
CODE

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 .
               ' /><br />' . "\n"
             : '' ).
           ( (isset($hide_sm_attributions) && $hide_sm_attributions) ? '' :
           '<small>' . sprintf (_("<h2><a href=\"../../email.htm\">Main</a></h2>SquirrelMail version %s"), $version) . '<br />' ."\n".
           '  ' . _("By the SquirrelMail Development Team") . '<br /></small>' . "\n" ) .
           html_tag( 'table',
               html_tag( 'tr',
                   html_tag( 'td',
                       '<b>' . sprintf (_("%s Login"), $org_name) . "</b>\n",
                   'center', '#DCDCDC' )
               ) .
               html_tag( 'tr',
                   html_tag( 'td',  "\n" .
                       html_tag( 'table',
                           html_tag( 'tr',
                               html_tag( 'td',
                                   _("Name:") ,
                               'right', '', 'width="30%"' ) .
                               html_tag( 'td',
                                   addInput($username_form_name, $loginname_value),
                               'left', '', 'width="*"' )
                                                               ) . "\n" .
                           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%"' );


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. roflmao.gif

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. laugh.gif

(Showing 50 last posts, newest on top)