Jump to content

Code Tags


Recommended Posts

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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


Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 months later...

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.