
davestewart
Members-
Posts
68 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
davestewart's Achievements

Member (2/5)
0
Reputation
-
Shorthand object creation syntax ( obj->property )
davestewart replied to davestewart's topic in PHP Coding Help
Check it out - a really neat answer appeared on Stack Overflow: http://stackoverflow.com/questions/455800/does-php-feature-short-hand-syntax-for-objects Nice. -
Rewritten URL is showing the new URL in the browser
davestewart replied to davestewart's topic in Apache HTTP Server
Nope. It's not a regexp thing I don't think. Either my server is off, or there's something else up with the htaccess. I'm going to sleep on this one. Thanks for you efforts in the meantime though. -
Rewritten URL is showing the new URL in the browser
davestewart replied to davestewart's topic in Apache HTTP Server
Ah no - that's the PROBLEM! The rewritten URL "tunes" is not being reflected in the links in the page, which are all relative. .htaccess rewrite: Realpath: /files/music/ RewritePath: /tunes/ Page URL: www.domain.com/tunes/ Page links: Link href: ./some-tune.mp3 Supposed file path: www.domain.com/tunes/some-tune.mp3 Actual file path: www.domain.com/some-tune.mp3 So for some reason the "tunes" part of the rewrite is not being reflected in the page links, even though they are relative and the page is showing "tunes" quite happily. Any ideas? Thanks, Dave -
Rewritten URL is showing the new URL in the browser
davestewart replied to davestewart's topic in Apache HTTP Server
That works great for the URL, but now the links in the page are missing the leading "tunes/" - they just appear to be in the web root. What are we missing? -
Rewritten URL is showing the new URL in the browser
davestewart posted a topic in Apache HTTP Server
Hi there, I admit, I'm no expert on mod htaccess, in fact I normally use snippets gathered together to make my own Frankenstein's monster of an htaccess. So my question, which I suspect may be based on false assumptions is this: I would like to rewrite "tunes" to "files/music", which I am doing as follows: RewriteEngine On RewriteBase / RewriteRule ^tunes/?$ files/music [PT,L] I was under the impression that this happened internally to the server, and the user would see "tunes" in the URL bar, but Apache would serve the default file in "files/music". However, it looks as if the request is being completely redirected and the page served is "files/music". Is it possible to do what I think it should be doing, or am I just misinformed? Thanks, Dave -
As part of a class I'm using to build tables, I've created a general Element class that holds a few properties and methods to output the essential bits of HTML tags, with an easy to use API: // properties $tag $content $class $style $attributes // constructor __construct($content = '', $class = '', $style = '', $attributes = '') // getters html() // wraps the following methods: open() content() close() It's about 50 lines of PHP. It could obviously be sub-classed for things like self closing tags, or specific tag types. My question is, does anyone know if native PHP simple XML would offer faster performance than my nice, simple, lean class? A typical table might hold 20 rows of 6 columns, so 120 or so operations. All my classes are also loaded in the same file. Cheers, Dave
-
[SOLVED] VIEW vs JOINs vs extra column in one table
davestewart replied to davestewart's topic in MySQL Help
OK, thanks very much everyone for your thoughts. Cheers, Dave -
[SOLVED] VIEW vs JOINs vs extra column in one table
davestewart replied to davestewart's topic in MySQL Help
I could use a stored function, but that won't actually affect the efficiency of the call will it? It will just package the call into something accessible. I was more interested in the actual performance benefits of one method over the other -
[SOLVED] VIEW vs JOINs vs extra column in one table
davestewart replied to davestewart's topic in MySQL Help
Well, I have a hierarchy of tables something like this: users users_companies companies services invoices items So say I query something like this: get all items for all unpaid invoices for company x (in the past 6 months) for user y That makes quite a few joins as everything is perfectly normalised. But I could include a reference to the company in each invoice, or even item table, which would save me deriving the company by JOINing up the chain to : services companies users_companies (users_companies is a relationship table as users can potentially belong to many companies). Does that make sense? -
I'm quite the database intermediate, which could be a dangerous thing (!) so I thought I'd ask some questions here first. I've got a range of tables in my application, and for most of my queries I need to do one or more JOINs. I have one particular query which will JOIN across 5 tables, and due to the way I'm about to allow all users to now belong to more than one group, I have to add a 6th (relationship) table to this (and most other) queries. The thing is, quite a few of the multiple JOIN series could be omitted if I just added a kind of "shortcut" column (that effectively give me the same information as the JOINs) to one of the right-hand tables, and I'd be able to do quite simple queries. Once new entries have been inserted into the table the data in this new entry will never change, so, my question is, now that all the queries are becoming quite complex, how to optimize both the code and the performance? Do I stick with JOINs and retain full normalisation? Do I start using a VIEW (I'm new to views)? Or do I add this new column and just start querying one or possibly two tables max rather than a hefty series of JOINs each time? I realise that there will be a minute level of redundancy with the last method, but it it worth it at the expense of cheaper (I presume) DB calls? At the moment the tables have a few hundred rows, but ultimately I expect them to have a few hundred thousand. Your thoughts would be really valuable, thanks. Cheers, Dave
-
I've an application where I'm cumulatively adding to the $_SESSION variable as the user completes different actions on the pages. To cut to the root of the matter, I have a session key called 'message', ($_SESSION['message']) which stores a bunch of data to do with an email message. Later in the application, on another page, I have a simple page variable $message which stores a message to present to the user regarding the result of an entirely unrelated process. The crazy thing is, the session variable is being overwritten by the page variable, but NOWHERE in my script have I asked it to do this! Sure, I'm starting the session on page load to access some other data, but nowhere do I mix these two up. Does anyone have any idea what is going on? I'm on PHP 5.2.9. Thanks, Dave
-
OK - final update to the app: I've now added a selection of 12 custom fonts, of varying sizes and styles, full punctuation and European character set for most of them. http://www.keyframesandcode.com/code/development/comment-headings/ I can't really see it needing anything else, so I think that's it for now. Enjoy!
-
Glad you guys might find it useful. I'll be making another update in a week or so, with a method to use your own custom fonts, so check back then...