cwarn23 387 Occupation: Genius Team Colleague Featured Poster

How did this make it into the so called "quality tutorials section"?

veedeoo 474 Junior Poster Featured Poster

Just a humble suggestion...for a tutorial such as this..The coding standard must follow the Zend Framework PHP Coding Standard. By doing so, the new learners or readers of the tutorial will be exposed to the proper coding standard and convention.

Please allow me quote one of the best quote I have read, when I was active in Zend community. Here I quote

One of the joys of PHP is that it’s very flexible, and that flexibility extends to how you layout your code. As long as you observe the basic rules, such as terminating each command with a semicolon and wrapping code blocks in curly braces, you can format your code however you like, because PHP ignores whitespace inside code blocks. As a result, many different styles of coding have sprung up. There’s nothing inherently right or wrong with any of them. As long as the code is readable—and works—that’s all that really matters.

But then again, there is a solid opposition to opening your php codes in shorthand..the coding style conventions states that

1. Always use the full opening PHP tag (<?php).
2. Omit the closing PHP tag (?>) in files that contain only PHP code. The closing PHP tag is optional, provided nothing else (e.g., HTML) comes after the PHP code. Leaving out the closing tag has the advantage of preventing unwanted whitespace triggering the “headers already sent” error when using includes(http://docs.php.net/manual/en/language.basic-syntax.instructionseparation.php).
3. Indent code four spaces (I always followed this, but not in the forum response settings).
4. Where practicable, restrict lines to a maximum of 80 characters.
5. Always use single quotes for strings, unless they contain variables to be
processed or other quotation marks.
6. Use a combination of single and double quotes in preference to escaping
quotes.
7. Put a space either side of the concatenation operator (.) for readability.
8. Insert a trailing space after commas for readability.
9. Break associative arrays into multiple lines, and use whitespace padding to align
both keys and values.
10. Put the opening and closing braces of classes and functions on separate lines.
11. Put the opening brace of a conditional statement on the same line as the condition,but the closing brace on a line of its own.
12. Use PHPDoc formatted comments. I am the number one guilty of this, because I normally comment mine with ##, but I already know the basics, so my category will be on the first quoted statement above.

That's my share on this topic, and I am hoping I did not offend anybody, because I am just a humble 19 yo Mathematics student at University of Princeton who loves to write and develop php applications, with main focus on video applications and electrical transformer calculators based on php. There are far more well experienced and knowledgeable coders in the this forum than a 19 yo student like myself. :)

Member Avatar for diafol
diafol

I think you make a few valid points here VD, however, I can't say I agree 100%.
2. is difficult as some of use like to separate PHP and HTML as in MVC setups, and using include files without the right closing tags can get messy. I know you try to qualify it with the second sentence, but I think it's a little more involved than you state.
5/6. OK, single quoted strings I believe are processed a little faster that double quoted ones - but I bet you wouldn't notice the difference! So would you concatenate instead of escaping? This is a performance thing I take it?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Just a humble suggestion...for a tutorial such as this..The coding standard must follow the Zend Framework PHP Coding Standard. By doing so, the new learners or readers of the tutorial will be exposed to the proper coding standard and convention.

Please allow me quote one of the best quote I have read, when I was active in Zend community. Here I quote


But then again, there is a solid opposition to opening your php codes in shorthand..the coding style conventions states that

That's my share on this topic, and I am hoping I did not offend anybody, because I am just a humble 19 yo Mathematics student at University of Princeton who loves to write and develop php applications, with main focus on video applications and electrical transformer calculators based on php. There are far more well experienced and knowledgeable coders in the this forum than a 19 yo student like myself. :)

I totally agree with all of that. I would also add the following

13. Do not join strings to variables or arrays. Instead use double quotes and place the variable or array inside the string like the following.

$var = "my string{$variable}";

//never the following

$var = 'my string'.$variable;
$var = "my string".$variable;

And for those who disagree I have ran brute force tests to time efficiency and the results can be found here SNIP

diafol commented: that's new to me, like it :) +14
Member Avatar for diafol
diafol

@cwarn:

results can be found here.

The mediawiki site "mediacode-daniweb.com" - is this an official part of daniweb?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

@cwarn:

The mediawiki site "mediacode-daniweb.com" - is this an official part of daniweb?

Well no it's not an official part of daniweb but rather a community based project inspired by daniweb to fill in the gaps where daniweb does not. Because dani said no a wiki would never be added to daniweb.com I setup a wiki at mediacode-daniweb.com which will soon feature some FAQ's to help answer the repeated questions that we keep on getting asked. Also I am hoping in the future to have an answer bot that will be able to search through the wiki content and answer any question within seconds. However I will need enough content first and content is a thing I will get plenty of.

happygeek 2,411 Most Valuable Poster Team Colleague Featured Poster

Hmmm, and your promotion of this is starting to smell spammy. Just a heads up...

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hmmm, and your promotion of this is starting to smell spammy. Just a heads up...

I am only trying to post related results and after all it does show some tests which were done about a week or two before the post was made. What is wrong with linking to relevant content which explains reasoning about a question the poster has asked. It's like saying I need to flag all posts which refer to the php.net site. Is that how it's meant to be?

happygeek 2,411 Most Valuable Poster Team Colleague Featured Poster

The difference is that it refers to a site that you own/operate, and which you are currently promoting quite a lot here on DaniWeb. The point being that self-promotion is treated as spam in the rules. Please note that I have not warned you or infracted you about this, but am just drawing your attention to the fact that self-promotion is not allowed on DaniWeb outside of a few specific forums in the business/marketing section.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

The difference is that it refers to a site that you own/operate, and which you are currently promoting quite a lot here on DaniWeb. The point being that self-promotion is treated as spam in the rules. Please note that I have not warned you or infracted you about this, but am just drawing your attention to the fact that self-promotion is not allowed on DaniWeb outside of a few specific forums in the business/marketing section.

Then how do you define the difference between self-promoting and self-helping with pre written content? I've written those tutorials so I can just give the same links over and over that way I don't have to retype the same stuff every time a new thread is made. Now this is just crazy that I can't even help others with content I have already written and that I have to write brand new content if I am to help somebody.

happygeek 2,411 Most Valuable Poster Team Colleague Featured Poster

The rules clearly state: "Do not mention, plug or refer to any product, service, or website you are affiliated with anywhere outside of Business Exchange forums specifically designated for this purpose".

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

The rules clearly state: "Do not mention, plug or refer to any product, service, or website you are affiliated with anywhere outside of Business Exchange forums specifically designated for this purpose".

That means technically speaking moderators aren't allowed to post links to another thread within daniweb.com because they are affiliated to the community. Well I'm stuck in the same position as that but in this case instead of being a moderator of daniweb.com as an owner of a website that helps provide information for the frequently asked questions for daniweb. Works two ways you know. I can't post links and moderators can't post links due to that one rule.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I've just worked out when I need to give the user a link to my site I'll simply give them a google link as I have just demonstrated. Then google sends them to my site. Since I'm not affiliated with google then let google list only one result with that weird search term and let the user click that result to go to my site. All good? :)

Member Avatar for diafol
diafol

:(
cwarn - sorry I asked - perhaps using daniweb in the domain name has prompted the comments?

@HG - I've done a few things on a website and I've pointed people there to have a look at it (e.g. live date [of the calendar version!] function) to get a feel of what the functions do:

http://diafol.org/datetime.php#

Seems I'm just as guilty. Doh! did it again. Sorry...

I was contacted some time ago by Wasted to post daniweb badges on my blog and my website following the farmer debacle. It seems to me to be a bit of a one-way relationship, especially when some members also sponsor (am thinking about sponsoring again).

This:

Do not mention, plug or refer to any product, service, or website you are affiliated with anywhere outside of Business Exchange forums specifically designated for this purpose

does seem to be a bit draconian. Would it be OK to leave a qualifier like:


The following link will take you to my website: (...url...). Daniweb is not reponsible for the content...

You get the idea.

I've linked to external sites before, e.g. other php forums to avoid stealing info - so what's the difference? If the site isn't meant to make money for the user, is it so bad?

happygeek 2,411 Most Valuable Poster Team Colleague Featured Poster

The linking to external websites where the help being offered is relevant to the question being asked and forms part of an answer being given on DaniWeb isn't problematical.

Linking to a site that you are the owner of in the above circumstances isn't problematical when it's not a regular occurrence, when it becomes a regular thing then the line between help and self promotion becomes somewhat blurred.

I only snipped the link in this case, and mentioned it to cwarn23, because there has been quite a lot of promotion for that particular site of late. Including a whole thread in Geeks' Lounge which was not answering any problem but rather just advertising the existence of the site itself.

The rule itself has been in place since I joined DaniWeb as an Admin in 2006, and has worked pretty well. I'm trying to be fair here, hence I have not been using the infraction stick but rather just snipping a link and pointing out that over-linking to a specific site owned by a specific member who is doing the linking treads a fine line between help and site promotion.

Member Avatar for diafol
diafol

OK, thanks HG. Lot clearer now. :)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

OK, I see where HG is going, and I see the conundrum cwarn has. I myself have written tutorials on another site that are linked to by many people here. That seems to be OK because DW doesn't want those tutorials as they are posted elsewhere. But they seem to be useful.

But in cwarn's case, he owns the site and wrote the tutorials. Hmm... And he wants the site to be affiliated directly with DW.

Well then, Dani, check out at his site. If it meets your quality standards and the articles and tutorials in his wiki complements well what we have here, give him your blessing. If not, what does he need to do to come up to your standards?

IMO, there should be no problem with a quality site that can be used in tandem with the forums. It's just an extended community at that point... Like a cousin site so to speak :icon_wink:

cwarn23 commented: thanks for pointing that out +12
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

OK, I see where HG is going, and I see the conundrum cwarn has. I myself have written tutorials on another site that are linked to by many people here. That seems to be OK because DW doesn't want those tutorials as they are posted elsewhere. But they seem to be useful.

But in cwarn's case, he owns the site and wrote the tutorials. Hmm... And he wants the site to be affiliated directly with DW.

Well then, Dani, check out at his site. If it meets your quality standards and the articles and tutorials in his wiki complements well what we have here, give him your blessing. If not, what does he need to do to come up to your standards?

IMO, there should be no problem with a quality site that can be used in tandem with the forums. It's just an extended community at that point... Like a cousin site so to speak :icon_wink:

It would be great if dani could approve the site so I can answer frequently asked questions with some tutorials I've written. After all they are frequently asked and that is why the links are or were frequently posted. I hope dani can share some insight on this one.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Speaking of which it's been over a week, the birthday party is over and dani hasn't replied to this thread and I still can't post links to any of the useful tutorials on the internet. How much longer must I wait? How long until dani sorts this thing out? It's annoying not being able to post links especially ones to very extensive tutorials I have written. Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.