323
votes
26answers
183k views

Convert HTML + CSS to PDF with PHP?

Ok, I'm now banging my head against a brick wall with this one. I have an HTML (not XHTML) document that renders fine in Firefox 3 and IE 7. It uses fairly basic CSS to style it and renders fine in ...
48
votes
9answers
17k views

Any good SASS parser for PHP?

I'm currently using a modified CSS Cacheer as an alternative but its syntax is somewhat vague and adoption is, well, abysmally low... Documentation is hard to come by as well. I'm looking to switch ...
42
votes
7answers
13k views

Multiple javascript/css files: best practices?

I have about 7 Javascript files now (thanks to various jQuery plugins) and 4-5 CSS files. I'm curious as to what's the best practice for dealing with these including where in the document they should ...
41
votes
12answers
40k views

How to wrap long lines without spaces in HTML?

If a user types in a long line without any spaces or white space, it will break formating by going wider than the current element. Something like: ...
28
votes
1answer
19k views

Resource interpreted as document but transferred with MIME type text/css

Resource interpreted as document but transferred with MIME type text/css This is the error that's showing up in Google Chrome Inspector. The file is: http://www.doanddare.org/css/style.css It is ...
26
votes
5answers
628 views

What method would be best to build this complex graph

After 15 years doing UI development, there's very little I look at and think, "how on earth do I do that." This is one of those times. A graphic designer has sold my clients on a very complex ...
18
votes
5answers
4k views

Given a background color, black or white text?

I'm trying to find a method for determining whether to use black or white text, given a background color (as a hex value). Has anyone dealt with this before? Is there an effective way to do this? In ...
18
votes
2answers
16k views

Getting DOM elements by Class name

I'm using PHP DOM and I'm trying to get an element within a DOM node that have a given class name. What's the best way to get that sub-element?
17
votes
18answers
23k views

Easiest way to alternate row colors in PHP/HTML?

Here's a PHP example of mine. Can anyone find a shorter/easier way to do this? <? foreach($posts as $post){?> <div class="<?=($c++%2==1)?‘odd’:NULL?>"> <?=$post?> ...
17
votes
3answers
2k views

Packing, caching, JS and CSS in PHP that differentiate between development and production environment

I am trying to make development easy and have highly optimized output in production. The goals of what I am trying to do is: Make production pages fast! I would like that the Google Page Speed and ...
16
votes
5answers
15k views

Path of assets in CSS files in Symfony2

Problem I have a CSS file with some paths in it (for images, fonts, etc.. url(..)). My path structure is like this: ... +-src/ | +-MyCompany/ | +-MyBundle/ | +-Resources/ | +-assets/ | ...
16
votes
9answers
10k views

Wrapping long text in CSS

I have text like <div style="float:left; width: 250px"> ...
16
votes
3answers
510 views

Preventing XSS attacks on user submitted HTML content in PHP, the eBay way

I've read so many articles describing methods to prevent XSS attacks in user submitted HTML content using functions such a htmlspecialchars and regexs, whitelisting/blacklisting and using html ...
16
votes
5answers
322 views

How to position the text next to images properly in PDF?

I'm using PHP, Smarty and TCPDF library to generate the PDF copy of a document. The document contains images of mathematical expressions from WIRIS editor along with the text content. I'm having a ...
15
votes
6answers
515 views

Formatting events according to start time

Still working on my planner/calendar application. I'm nearly done, I got some of the harder parts working but I'm stuck at one more difficult part. I want to show my events in a grid according to ...

1 2 3 4 5 310
15 30 50 per page