5076 posts
    Elite Author: Sold more than $75,000 on Envato Market Has sold $125,000+ on Envato Market Has been part of the Envato Community for over 5 years Helps us moderate the forums
+11 more
felt_tips Volunteer moderator says

Hi there,

‘Scuse the cross post…I put this in VideoHive originally, then realised it’s probably relevant to all market places.

I was just trying to type a code fragment in to one of these threads. When I did, it removed all of my formatting. Not only was it difficult to read, but where I had commented the code at the end of a line, it changed the functionality too.

Is this a bug or is there something I’m missing. I thought the whole point of a code block was that it kept verbatim everything you typed in without recognising any of the symbols as text formatting.

-felt.

2541 posts
    Has referred 10+ members Has sold $100+ on Envato Market Has collected 50+ items on Envato Market Located in United States
+9 more
CreatingDrew says
Hi there,

‘Scuse the cross post…I put this in VideoHive originally, then realised it’s probably relevant to all market places.

I was just trying to type a code fragment in to one of these threads. When I did, it removed all of my formatting. Not only was it difficult to read, but where I had commented the code at the end of a line, it changed the functionality too.

Is this a bug or is there something I’m missing. I thought the whole point of a code block was that it kept verbatim everything you typed in without recognising any of the symbols as text formatting.

-felt.

Code tags are to signify that the text contained is code, it is good and relevant markup, but it will parse code in between the tags, php code for example. You need to convert the html entities (a less than tag become < ) or use a syntax highlighting plugin.

5076 posts
    Elite Author: Sold more than $75,000 on Envato Market Has sold $125,000+ on Envato Market Has been part of the Envato Community for over 5 years Helps us moderate the forums
+11 more
felt_tips Volunteer moderator says

Thanks Creating Drew,

Do you know how I force a line break and a tab?

-f.

<
707 posts
    Has referred 10+ members Has sold $10,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 10+ items on Envato Market
+2 more
ChillThemes says
Do you know how I force a line break and a tab?
&nbsp; /* Non-breaking space */ <br /> /* Line break */

This simplifies the process: http://simplebits.com/cgi-bin/simplecode.pl

5076 posts
    Elite Author: Sold more than $75,000 on Envato Market Has sold $125,000+ on Envato Market Has been part of the Envato Community for over 5 years Helps us moderate the forums
+11 more
felt_tips Volunteer moderator says

Thanks guys… that simplebits link looks great, but I’ve just pasted the results in below… and it’s coming out completely unformatted to me. How does it look to you? Is this some issue with the Envato forums parsing?

-felt.

tX = 20; //chars per line<br /> tY = 10; //no of lines<br /> <br /> tText = ""; //initialise text<br /> <br /> for (j = 0; j &lt; tY; j++) {&#160;&#160;//loop thru lines<br /> for (i = 0; i&lt;tX; i++) { //loop through chars<br /> t= random(100)&gt;50; //statement that is true half of the time<br /> t = (t?"1":"0"); //convert to string<br /> tText += t; //append to text<br /> }<br /> tText += "\r"; //add line break<br /> }<br /> <br /> tText;<br /> <br />
5076 posts
    Elite Author: Sold more than $75,000 on Envato Market Has sold $125,000+ on Envato Market Has been part of the Envato Community for over 5 years Helps us moderate the forums
+11 more
felt_tips Volunteer moderator says

Worked it out! It’s the

 
that I was looking for.. :)

tX = 20; //chars per line
tY = 10; //no of lines

tText = ""; //initialise text

for (j = 0; j < tY; j++) {  //loop thru lines
    for (i = 0; i<tX; i++) { //loop through chars
        t= random(100)>50; //statement that is true half of the time
        t = (t?"1":"0"); //convert to string
        tText += t; //append to text
    }
     tText += "\r"; //add line break
}

tText;
2541 posts
    Has referred 10+ members Has sold $100+ on Envato Market Has collected 50+ items on Envato Market Located in United States
+9 more
CreatingDrew says
Worked it out! It’s the <pre> </pre> that I was looking for.. :)
tX = 20; //chars per line
tY = 10; //no of lines

tText = ""; //initialise text

for (j = 0; j < tY; j++) {  //loop thru lines
    for (i = 0; i<tX; i++) { //loop through chars
        t= random(100)>50; //statement that is true half of the time
        t = (t?"1":"0"); //convert to string
        tText += t; //append to text
    }
     tText += "\r"; //add line break
}

tText;

Oh lol, I didn’t know you were referring to posting code on these forums. Yup, just wrap them in pre tags and then those in code tags. Demo:


<?php $doh = array('I', 'misunderstood', 'you');
echo implode(' ', $doh);
?>

by
by
by
by
by
by