- Community Moderator
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Item was Featured
- Author had a File in an Envato Bundle
- Beta Tester
- Has been a member for 4-5 years
- United Kingdom
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.
- Community Moderator
- United States
- Was featured in a podcast
- Attended a Community Meetup
- Author had a Free File of the Month
- Bought between 50 and 99 items
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
- Contributed a Tutorial to a Tuts+ Site
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.
- Community Moderator
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Item was Featured
- Author had a File in an Envato Bundle
- Beta Tester
- Has been a member for 4-5 years
- United Kingdom
Thanks Creating Drew,
Do you know how I force a line break and a tab?
-f.
<
Do you know how I force a line break and a tab?
/* Non-breaking space */
<br /> /* Line break */
This simplifies the process: http://simplebits.com/cgi-bin/simplecode.pl
- Community Moderator
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Item was Featured
- Author had a File in an Envato Bundle
- Beta Tester
- Has been a member for 4-5 years
- United Kingdom
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 < tY; j++) {  //loop thru lines<br />
for (i = 0; i<tX; i++) { //loop through chars<br />
t= random(100)>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 />
- Community Moderator
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Item was Featured
- Author had a File in an Envato Bundle
- Beta Tester
- Has been a member for 4-5 years
- United Kingdom
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;
- Community Moderator
- United States
- Was featured in a podcast
- Attended a Community Meetup
- Author had a Free File of the Month
- Bought between 50 and 99 items
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
- Contributed a Tutorial to a Tuts+ Site
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);
?>
