jib Posted June 25, 2008 Share Posted June 25, 2008 I am bit confused here, I got a print line in my code which is giving me errors print "<a href=\"moreinfo.php?title=$ID\" class="results">"; does not work but same thing out of php does... eg. <a href="link.php" class="classname">linkname</a> Can anyone explain? Been googling for awhile but haven't found anything... Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/ Share on other sites More sharing options...
.josh Posted June 25, 2008 Share Posted June 25, 2008 print "<a href='moreinfo.php?title=$ID' class='results'>"; Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/#findComment-573787 Share on other sites More sharing options...
DarkWater Posted June 25, 2008 Share Posted June 25, 2008 Or: print "<a href=\"moreinfo.php?title=$ID\" class=\"results\">"; Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/#findComment-573789 Share on other sites More sharing options...
.josh Posted June 25, 2008 Share Posted June 25, 2008 yeah but escaping quotes is ugly like my ex-girlfriend's sister ugly. Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/#findComment-573791 Share on other sites More sharing options...
jib Posted June 25, 2008 Author Share Posted June 25, 2008 *sigh* I always think its something bigger but it's always a dodgy syntax thing thanks <3 Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/#findComment-573792 Share on other sites More sharing options...
DarkWater Posted June 25, 2008 Share Posted June 25, 2008 Well, I personally would have use sprintf() or printf(), which is much hotter than your ex-girlfriend and her ugly sister. Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/#findComment-573807 Share on other sites More sharing options...
.josh Posted June 25, 2008 Share Posted June 25, 2008 I really don't see the value of those functions. You have a huge block of code with multiple references to a variable and what..seriously, nothin' ctrl+f and replace couldn't handle. I think it makes coding less readable. I mean, to me, it like, takes away the point of naming variables something meaningful. IMO. Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/#findComment-573810 Share on other sites More sharing options...
DarkWater Posted June 25, 2008 Share Posted June 25, 2008 OMG I HAVE 2K POSTS. Yay. Anyway. It allows for less escaping and matching of quotation marks and concatenation operators and all that stuff. It makes code much more readable, at least the long strings with a lot of variables or HTML... Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/#findComment-573811 Share on other sites More sharing options...
.josh Posted June 25, 2008 Share Posted June 25, 2008 yeah i guesso...if you're using extremely long variable names...but if you're at that point then imo you probably need to look into namespaces or at least using better names... I'll concede to less quotes but you can completely code without having to escape quotes if you make use of single quotes inside double quotes and use { }'s around your vars as necessary. imo that's much cleaner and conforms more to coding standards. I put that in the same class as not using quotes around attributes in html. it "technically" works but is not the standard. bottom line is imo printf and sprintf promotes laziness. p.s.- gratz on 2k Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/#findComment-573813 Share on other sites More sharing options...
DarkWater Posted June 25, 2008 Share Posted June 25, 2008 I use {} around my arrays if I don't use printf(), but sometimes mismatching quotes gets annoying. D: Guess it's just personally preference. xD Quote Link to comment https://forums.phpfreaks.com/topic/111767-solved-printing-link-with-class-problem/#findComment-573819 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.