-
-
SQL Problem
I found the solution. PDO doesn't allow you to pass table names as prepared values - presumably it converts the table name into a string. $sql = "SELECT * FROM table_name t1 LEFT JOIN other_table t2 ON ( t1.id = ? )"; $value = "t2.id"; $sth = $dbh->prepare($sql); $sth->execute($value); Doesn't work. You have to have t1.id = t2.id hardcoded. You could of course have t1.id = 2 or something like that. No errors are thrown.
-
-
SQL Problem
Hi folks, I'm kind of burned out so I might be overlooking something simple here, but I have a piece of SQL code that works in PHPMyAdmin but not PHP. Basically it's just the num_expressions column that comes up empty (0) in PHP but has good values in SQL. The SQL statement is: SELECT ca.category_name, ca.category_description, ca.category_slug, COUNT( e.id ) AS num_expressions FROM Categories ca LEFT JOIN Expressions e ON ( e.category_id = ca.id ) GROUP BY ca.category_name In PHP I have it in an array, like so: Array ( [0] => SELECT ca.category_name, ca.category_description, ca.category_slug, COUNT(e.id) AS num_expressions FROM Categories ca LEFT JOIN Expressions e ON ( e.category_id = ? ) GROUP BY ca.category_name [1] => Array ( [0] => ca.id ) ) Which is processed by this function... public function preparedQuery(array $values) { $dbh = self::connect(); //returns a PDO DBH object $sth = $dbh->prepare($values[0]); $sth->execute($values[1]); if (empty($sth)) { throw new Exception("Nothing was queried."); } $sth->setFetchMode(PDO::FETCH_ASSOC); return $sth->fetchAll(); } And it results in a perfectly fine multi-dimensional array with all good values, except that the num_expressions column is filled with 0s. Like I said, the exact same query on PHPMyAdmin fills that column up with good values. Anyone?
-
How effective is the Social Bookmarking Submission ?
If you have G.Anal on your site, it's been suggested that visitor statistics (e.g. how many come, how long they stay, how many pages they visit, what their page load time is, etc.) affect search rankings to some degree. But unless we're talking thousands/day it's probably not worth considering.
-
-
-
-
How to separate my html from my database php functions
Yeah the MVC pattern is what I was getting at - I was tired when I wrote that. The book I mentioned is a pretty sweet intro to that as well. I guess what I was thinking was that OO programming is separation of code, but specifically it's separating functionality within PHP. I think frameworks are a great tool especially if you go through it and figure out how and why the people who put the framework together did it the way that they did. Their best practices are a good starting point. I just think that "learn a framework" might be an answer to a lot of problems, and maybe not specific enough. An article on MVC frameworks might do (unfortunately I don't have a link, sorry OP! Google MVC though, I think Rallport is right and that's what you're looking for). There's also a "Quirks mode" for browsers. I'm just a best-practices junky and dealing with short-tags has given me a headache before when migrating or repurposing code. It's just easier to learn not to use them rather than learn how to fix them when they break everything. Like tables or things that "work" but shouldn't. Much love.
-
How to separate my html from my database php functions
Hey, a couple really quick things... I think you're talking about Object Oriented coding. Specifically the aspect of keeping everything separated into a singular purpose as much as possible. It's not about keeping HTML and PHP separate but about keeping the purpose of the function down to one specific thing. That's a pretty big topic, and instead of figuring out a framework (which is super overkill for your question and probably won't actually help), I'd read a book on the subject (like PHP Objects, Patterns and Practice). Also, your PHP open tag is wrong. It should be <?php ?>. I realize it's more characters, but by doing it your way you'll break all modern PHP installs unless you put them into "I'm a bad programmer" mode. Much love!
-
SEO,Back Linking,SEO Programs
I agree with the on-page stuff. I used to review on-page SEO and some of the stuff I saw was obscenely bad and there was always huge room for improvement. Keyword stuffing is the obvious, but anchor text, misuse of tags, page load times, etc. are big pitfalls. Then a lot of people have strange notions about what is "good" for on-page SEO, and they miss out on the great opportunities like just having relevant pictures (with good tagging, e.g. a picture about a fishing boat in leeds with the alt text, "A fishing boat in leeds."), videos, and do-follow links out to relevant but not directly competing authority sites. But backlinking is powerful and you can't just ignore it. Absolutely some can be spammy, but most people shy away from the legitimate backlink building just because they're lazy. Building backlinks is like getting the word out about a new product - it takes leg work but if you don't do it you just have a lot of products and no customers. Relying on content is sometimes enough, but very very rarely.
-
Feedback on Biz Card
I actually prefer the original to all of the future designs. The one change that I liked was the font you used for the contact details on the v1b version. IMHO if you kept the original but changed the font for that info, it would look professional but retain the great first font choice.
-
Should Graphic Designers code?
I'd say it's probably a good idea to learn all of the skills on a really low level at least, especially if you're working with developers all of the time. The same goes the other way as well - developers should know the design process and the complexities of it. It's just better for relationships when you speak the same language. Also, I just like messing around with code.
-
how get seo project ?
I'm struggling to come up with a non-sarcastic answer to "SEO is dead." Rather than saying nothing at all, however, I'd like to add that "SEO is not dead."
-
so who do you use for hosting and why?
I use http://zensix.com/ but they just changed their pricing and packages. I got grandfathered in at my old price and package, but I'm not sure about the new ones. I like them because they're exclusive and make me feel special haha. Also, the first and only customer support ticket I filed was answered in less than 30 minutes.
-
-
Building a forum from scratch
For learning PHP (this one is hard to find and a little old, but it was SUPER easy to follow for me when I learned): http://devzone.zend.com/article/627 For more advanced and recent things, I very very highly recommend that you pick up a copy of this book (affiliate link - If you like ebooks you can check out library dot nu): http://www.amazon.com/gp/product/143022925X/ref=as_li_ss_tl?ie=UTF8&tag=notallowed&linkCode=as2&camp=217145&creative=399369&creativeASIN=143022925X As for creating a forum from scratch, here's my advice: Only do this if you are using it to teach yourself PHP and MySQL. You're not going to have a usable product at the end of this (unless we're talking a year or more of you learning and improving), but you'll learn a lot. It might be better to start by looking at an existing forum software and modifying it. This will teach you the small things first, rather than the huge things -> big things -> small things approach which will just drive you insane. Good luck and have a super awesome day!
-
Typography Resources
Ah thanks! I read that whole series, it had some gems For the most part I think I'll be trying out what I've learned so far for the next little while, but if anyone has any major suggestions or favourite resources that haven't been mentioned I'm always open for more!
-
Typography Resources
These are my notes on the most recommended resource. The biggest thing for me was the idea of basic leading and how to get everything to line up. Yeah, I'm that bad! The Elements of Typographic Style Applied to the Web 1. Horizontal Motion 1. "Anything from 45 to 75 characters is widely regarded as a satisfactory length of line." (serif, 1-column, 66 ideal) 2. text-justify:inter-character - Could be tested on justified text. Better justification? 3. Consider applying +5-10% letterspacing to strings of capitals (e.g., abbreviations), small-caps (I'm thinking of headers), and digits (phone numbers or dates). 4. Make sure all kerning (letter-spacing) is done in ems to preserve it across font sizes. 5. But it tends to be a bad idea to letter-space lower-case characters. 6. Interesting to note: some letter pairs (E.g. To or Wa) have decreased kerning built into the font file. Who knew? 7. For related content (tables as a big example), don't force the eye to stretch or use convoluted lines. Use short white space to imply a connection - then there's no intermediate step. 2. Vertical Motion 1. The leading in web design is line-height - font-size. E.g., line-height: 15px - font-size: 12px = 3px leading. 2. Leading in css is applied above and below the text. Say this is vertical rather than horizontal: 2px | 2px (=4px leading). Center text vertically! 3. Set line-height without units (it'll be font-size * line-height, so 1.1 = 110% of the font-size). 4. As above, you can set it like so: font: 12pt/1.25 serif; Where the 1.25 is the leading. 5. Common leading is 1.2-1.5 on the web. Ergo, always higher than the default by at least 20%. 6. Margin-top and margin-bottom for paragraphs should generally be the same as the line-height. 7. Basic leading should always be maintained even if you play around with asymmetrical header spacing (see picture in #. 8. (The image is on the site and clipped into my notes..) 9. Another example of maintaining basic leading is for side-notes. If the font is smaller, the margins/line-height need to be increased to fill a whole line. 10. This is just a guess, but if the font is larger you'd probably want it to be some multiple of the leading. E.g., for an 18px basic leading and a larger font for the side-note, you could get away with 36px leading (2x). 11. Images should also be sized by the basic leading so as not to disrupt text (ah, yes, that's a big Aha moment). 3. Blocks and Paragraphs 1. "In continuous text mark all paragraphs after the first with an indent of at least one en." There are no margins between subsequent paragraphs, only other elements (blockquotes etc). Interesting, I'll try it. Selector is p + p {} 2. For blockquotes (and similar), try applying the same margin from the top/bottom values to left/right. Again, ensure that it fits into the basic leading. 3. Center verse or poetry on the longest line: http://webtypography.net/Rhythm_and_Proportion/Blocks_and_Paragraphs/2.3.4/ 4. Etiquette of Hyphenation & Pagination 1. p { hyphenate: auto; }. Try it? 5. Size 1. It seems like there maybe be a "traditional scale" for headings. I assume that that's in The Elements of Typographic Style. Other Resources http://net.tutsplus.com/tutorials/html-css-techniques/six-ways-to-improve-your-web-typography/ 1. (Nice little diagram of typography with definitions) http://sixrevisions.com/web_design/a-basic-look-at-typography-in-web-design/ 1. "Sans serif fonts have been proven to be more easily read online in body copy because serifs make it tougher for the eye to follow, while the opposite is true for printed text." 2. "Serifs work great in headlines and headings" http://www.smashingmagazine.com/2010/11/04/best-practices-of-combining-typefaces/ 1. Tall x-height = good readability 2. Font-weight contrast between header and body copy really isn't an optional thing. 3. If multiple hierarchical elements are close together, make sure that they are easily distinguishable and don't flow easily (100% -> 90% -> 80% -> 70% = BAD. Rather, 100%, 80%, 90%, 70%). 4. Another good contrast is Distinct vs. Neutral (think two cursive fonts.. ew) 5. Not TOO much contrast http://www.markboulton.co.uk/journal/comments/five-simple-steps-to-better-typography 1. "A simple rule is your leading should be wider than your word spacing." 2. "If your measure [(Width, or better how many characters/line)] is wider than the guidelines for optimum legibility then increase the leading" 3. "When reversing colour out, eg white text on black, make sure you increase the leading, tracking and decrease your font-weight" 4. "The general rule of thumb in tracking your words (not the characters) is that the shorter the line length the tighter the tracking" 5. The quotation marks in pull quotes shouldn't disrupt the "ragged left" flow. Same is true for bulleted lists. 6. (image on p4 of this article) 7. For #6, wherever you start, just move along the path. E.g., roman lower case -> FULL CAPS -> bold italic lower case is ok.
-
Typography Resources
I get flack for this all of the time but for some reason I LOVE instant coffee. This is after having worked at a couple coffee shops and brewed espressos all day at a small Italian restaurant near where I went to uni. Mmm instant coffee. Anyway, I'm checking out http://webtypography.net/ and I've gone over some of the other resources from http://net.tutsplus.com/tutorials/html-css-techniques/six-ways-to-improve-your-web-typography/. It doesn't look like I can update the first post but I'll definitely get back to you guys with what was the most helpful (and maybe some typography doodles! Wait.. are they called doodles? Oh no!). I have a nice little folder that I'll be working through over a nice cup of... Green tea.
-
Typography Resources
Hi! I struggle for hours with typography. I sit there scrolling through the huge list of fonts in PS and moving the letter-spacing and line-height values up and down by single pixels. And then I change things back, make some coffee and get inspired by a burst of caffeine. Then I go back to whatever it was before. The final result is an "Eh, it doesn't look horrible any more" kind of result. I've never come across any resources on good typography. Well, I see lots of galleries and "basics" and "for beginners" guides out there, but I'd like a 4-5 hour exercise in reading and note-taking to actually get a grip on it. Help me out? If there's lots of good information I'll update the first post. Thanks a lot!