ngreenwood6 Posted March 10, 2009 Share Posted March 10, 2009 I wonder if we cant implement something into this forum that will automatically use code tags before <?php if it isnt already there and after the ?> or <html></html>. So many times you see the new users come and not use code tags. Anyone else have any input on a way that we could implement this without messing with peoples post. The problem I see that would happen right now is if they started with php and then ended it and started html it would start and stop the code tags making it look like 2 separate files. Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/ Share on other sites More sharing options...
revraz Posted March 10, 2009 Share Posted March 10, 2009 Find the mod that will do it for these forums... Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781310 Share on other sites More sharing options...
ngreenwood6 Posted March 10, 2009 Author Share Posted March 10, 2009 Lol best solution were probably going to get lol Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781330 Share on other sites More sharing options...
revraz Posted March 10, 2009 Share Posted March 10, 2009 What other solution were you thinking of? No one will custom write it if that's what you were thinking. Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781374 Share on other sites More sharing options...
premiso Posted March 10, 2009 Share Posted March 10, 2009 The problem you have with this, is php can be inside strings etc. Doing this would make a mess of posts. Granted users are lazy, it still needs to rely on them, if they do not, they suffer the consequences, hence not being helped by certain people etc. Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781416 Share on other sites More sharing options...
ngreenwood6 Posted March 10, 2009 Author Share Posted March 10, 2009 Premiso thats what I was thinking but maybe if it auto put it in there they would be forced to check it and fix it if it did it incorrectly at least lol. revraz I wouldnt mind writing a custom one as long as we actually came up with a good solution Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781456 Share on other sites More sharing options...
Mchl Posted March 10, 2009 Share Posted March 10, 2009 While tempting, think what to do with this code: <?php session_start(); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">"; ?> <channel> <?php echo $_SESSION["foo"]; ?> <!--//some more rss code --> <description><![CDATA[<?php echo "<?php \$foo ?>" ?>]]></description> <!-- etc... --> even current highlighter fails... Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781509 Share on other sites More sharing options...
Philip Posted March 10, 2009 Share Posted March 10, 2009 I don't think putting in tags automatically would be a good solution. A simple check to see if there are code tags (<?php, <html>, etc) outside of or [php] tags, then generate a warning (much like the one that says "Warning: someone has replied blah blah"). Something like the following would suffice I think.[color=red][b]Warning:[/b] you currently have code outside of [code] tags, this will disable any formatting of the code[/color] Even so, that could get annoying when you type a short 4 line reply like: <?php session_start(); // don't forget the line above! ?> And, it most likely wouldn't be able to detect snippits without opening tags: $foo = 'bar'; echo $foo; As mentioned before, it's up to the OP. But it is super annoying viewing posts with code not in or Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781535 Share on other sites More sharing options...
Zane Posted March 10, 2009 Share Posted March 10, 2009 I don't see the point in this mod..if this were installed then there would be code tags galore. If you so mentioned a word of "code"...you would be code tagged.Just the way you did KingPhillip[quote][nobbc]A simple check to see if there are code tags (<?php, <html>, etc) outside of [code] or [php] tags,[/nobbc][/quote]If the mod worked logically it would do this[quote]A simple check to see if there are code tags ([code]<?php, <html>, etc[/code]) outside of [nobbc][code] or [php] tags,[/nobbc][/quote]or this[quote]A simple check to see if there are code tags[nobbc] ([code]<?php[/code], [code]<html>, etc[/code]) outside of [code] or [php] tags,[/code][/nobbc][/quote]something like that Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781605 Share on other sites More sharing options...
Maq Posted March 10, 2009 Share Posted March 10, 2009 It's going to cause more hassle then help IMO. Using code tags is etiquette and common on almost every coding forum. The only thing that would probably be helpful is making it more obvious to people that don't know. Other than that, I don't know what else you could do. ??? EDIT: And besides, half the code posted don't even start with <?php or tags, so it would start in the middle of the code and be impossible to understand. Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781614 Share on other sites More sharing options...
Daniel0 Posted March 10, 2009 Share Posted March 10, 2009 I just ignore people with large chunks of code without or [php] tags. If they cannot even be bothered to do that then I won't be bothered to spend my spare time on helping them for free. Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-781641 Share on other sites More sharing options...
ngreenwood6 Posted March 11, 2009 Author Share Posted March 11, 2009 Yeah daniel I am almost tempted to just go your route because if I notice someone with only a few posts that didnt use code tags I kindly let them know and usually still offer my help. The thing is though they dont even try to edit the post to correct it which would be the first thing that I did when someone told me that. @maq I think you have the best solution here as to make it more obvious to posters. Maybe on the reply page we can put in big red bold letters to please remember to use code tags lol. That would surely catch my attention. Another thing to point out is that it is the # symbol because I have ran into this nine times out of ten where I tell someone to use code tags and they say how do i do that and I say its the # symbol and you see them start using it lol. Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-782327 Share on other sites More sharing options...
moe180 Posted June 11, 2009 Share Posted June 11, 2009 Maybe on the reply page we can put in big red bold letters to please remember to use code tags lol. That would surely catch my attention. Another thing to point out is that it is the # symbol because I have ran into this nine times out of ten where I tell someone to use code tags and they say how do i do that and I say its the # symbol and you see them start using it lol. I have never used a code forum before and had no idea about code tags, but this morning Daniel0 did mine for me with a gentle reminder that it is polite to do so and my responsibility to use them. so I have been searching the site for information on how to firstly do it and secondly how to use them correctly, i understand this may be a stupid statement but I have not really got the experience or knowledge of how to use them correctly, so may I make a suggestion that a sticky of some sort is put on the forums page with maybe how to do them, when to use them, and some information for complete newbies of the importance of using them, I did not leave them off my post because I was lazy or anything else like that it was because I genuinely did not know, the reason for posting this is as in the future I do hope to progress into being a useful member of the site and hopefully being able to help others in the future instead of draining the lifeforce of the very helpful ones already here as I am at the moment. Thanks guys for all the help and advice I have been given. Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-853668 Share on other sites More sharing options...
gevans Posted June 11, 2009 Share Posted June 11, 2009 so may I make a suggestion that a sticky of some sort is put on the forums page with maybe how to do them, when to use them If you wanted that for each forum, that's a lot of identical stickies over the place. http://www.phpfreaks.com/page/rules-and-terms-of-service#toc_forum_dos Forum DO's 4. Do user proper formatting for posts ( or [code] tags around necessary code). RULES You wouldn't play poker without knowing the rules... Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-853674 Share on other sites More sharing options...
moe180 Posted June 11, 2009 Share Posted June 11, 2009 I did not mean 1 on each forum sorry I mean on just the main forum page so people like me who have not a clue of how to add tags could go in and learn how to actually add them to posts what tags to use ect, as I have looked on here and am still looking and cannot find out how to add them, I may be thick I do not know but just in case :-[i am it may would be helpful to have somewhere to find the information if possible. I know you guys are all very experienced at this but for someone like me who is new to all this its very daunting. Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-853675 Share on other sites More sharing options...
Zane Posted June 12, 2009 Share Posted June 12, 2009 Look at the image Some code stuffs with too makes this Some code stuffs with too [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/148762-code-tags/#findComment-854577 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.