Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > WordPress and PHP

WordPress and PHP
Thread Tools
Oisín
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 17, 2004, 05:06 AM
 
So, I'm trying to set up WordPress on my domain... which is not as easy as they make it out to be when you know nothing about MySQL or PHP!!!

I get to the part where they tell me to run the install.php file. I do this, but it just gives me - well, not what I want.

In FireFox it just writes the source of the PHP file. In IE, it shows up as a page like it's supposed to, but half of the code is still there.

I looked at WP's homepage and found a reference about it in the common installation problems section:

I see a bunch of gibberish on my page, when I look at the source I see lots of weird stuff like <?php

If you see code like that anywhere on your pages it most likely means that your web server isn't parsing the server-side code that runs WordPress. Make sure your host meets the requirements, and contact your host support with the problem.
This means that the server isn't parsin the PHP, right? That I don't have PHP 4.06 which is required? Well, that's just the problem, 'cause my host's website says that I do!

I'll write to them if needs be, but I've already had like five emails off to them in the past week or so, so I thought I'd ask in here first - I'm beginning to feel like a host stalker...
     
thePurpleGiant
Mac Elite
Join Date: May 2001
Status: Offline
Reply With Quote
May 17, 2004, 05:13 AM
 
If it is a PHP file and it shows you the source instead of rendering the page, it sounds like PHP isn't installed on your server. There may be other reasons, but this seems to be the most obvious.
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 17, 2004, 05:29 AM
 
Originally posted by thePurpleGiant:
If it is a PHP file and it shows you the source instead of rendering the page, it sounds like PHP isn't installed on your server. There may be other reasons, but this seems to be the most obvious.
Is there some way of finding out if PHP is installed (and which version it is), without having to go writing off to the support team at your hosting company?
     
Love Calm Quiet
Mac Elite
Join Date: Mar 2001
Location: CO
Status: Offline
Reply With Quote
May 17, 2004, 06:36 AM
 
If you want ease of working with PHP/MySQL you may really want to consider getting a host where you don't feel inertia about "writing to host" about problems.

As a total newbie and experimenter with PHP/MySQL, it was critical for me to have access to the host's support. I host one site with BlueDomino.com, and although they had some MySQL initial default settings that gave me trouble, their 24/7 Live Support Chat feature has always come through for me; they always pursued completely satisfactory support for any difficulty this newbie encountered. Another site I have hosted by PHPWebHosting.com - folks who (obviously) orient toward serving PHP/MySQL.

The domain registration discussions in http://forums.macnn.com/showthread.p...hreadid=210972 also cover virtues of other PHP-friendly HOSTS that other people in the Web Developer Forum found reliable.

Hope that's helpful.
TOMBSTONE: "He's trashed his last preferences"
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 17, 2004, 06:57 AM
 
Originally posted by Love Calm Quiet:
If you want ease of working with PHP/MySQL you may really want to consider getting a host where you don't feel inertia about "writing to host" about problems.
It's not that I feel inertia about writing to them particularly, it's just me being a wee bit paranoid (ie. "Oh no, this is the fifth time I'm writing to them this week, they must be getting so annoyed with me and think I'm so dumb", etc.).

I just thought maybe there'd be a faster ways to do it as well - like, finding out which version of PHP the server has, etc. Maybe not...
     
Love Calm Quiet
Mac Elite
Join Date: Mar 2001
Location: CO
Status: Offline
Reply With Quote
May 17, 2004, 07:19 AM
 
You may be able to get all the info you need by creating a php page and running the PHP command:

echo phpinfo()

I believe that gives you all the MySQL and PHP info about your server settings and configuration (including your Passwords in some settings, I seem to recall, so be careful with it).
TOMBSTONE: "He's trashed his last preferences"
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 17, 2004, 08:18 AM
 
Originally posted by Love Calm Quiet:
You may be able to get all the info you need by creating a php page and running the PHP command:

echo phpinfo()

I believe that gives you all the MySQL and PHP info about your server settings and configuration (including your Passwords in some settings, I seem to recall, so be careful with it).
(edited for the sixteenth time!)

Okay, so I did simply what it says in the dummies' guide to PHP from php.net and created a super-simple script:

[php]<html>
<body>
<?php echo phpinfo(); ?>
<?php echo '<p>Hello world</p>'; ?>
</body>
</html>[/php]

(I added the 'hello world' part because that's exactly, by the letter, the example they use on php.net)

- and it didn't work! Typical... so now I guess I have to write to them anyway... ah well, thanks for your help anyway, guys
( Last edited by Ois�n; May 17, 2004 at 08:57 AM. )
     
philzilla
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
May 17, 2004, 08:57 AM
 
Originally posted by Ois�n:
So, for the PHP-ically challenged among us - would that just be opening an empty document, writing echo phpinfo() and saving it as a .cgi or .php file?
1. new text document
2. type: <? phpinfo(); ?>
3. save as info.php
4. upload and test in browser

depending on how tightly the server admin runs things, you might need to use <?php phpinfo(); ?> instead.
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 17, 2004, 08:59 AM
 
Edited previous post ^^^
     
Love Calm Quiet
Mac Elite
Join Date: Mar 2001
Location: CO
Status: Offline
Reply With Quote
May 17, 2004, 09:09 AM
 
Well, I wish you had someone more php knowledgeable than I to guide you, but here is the complete content of a file I named myphpinfo.php and uploaded to root directory of www.mysite.com:

<title>Test of PHP Installation via phpinfo() command</title>
<?php echo phpinfo() ?>

then when I load www.mysite.com/myphpinfo.php into safari, I get all the PHP specs on my site's server.

*** Note: you DON'T want to LEAVE that on your web server - it's not secure and anyone can access your info. [Maybe somebody here with real experience can explain to both of us a SIMPLE was to have this PW-protected for rank-beginner PHP-ers?]

I don't have my ref books with me, but I'm sure there's a parallel command that also gives you the MySQL specs.

If you're going to mess around with this stuff at all, as a bare minimum, get one of Larry Ullman's books, like "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide"

Also, get the free/shareware CocoaMySQL onto your Mac so you can GUI-access your data and data structure from your Mac.
TOMBSTONE: "He's trashed his last preferences"
     
thePurpleGiant
Mac Elite
Join Date: May 2001
Status: Offline
Reply With Quote
May 17, 2004, 09:14 AM
 
Originally posted by Ois�n:
(edited for the sixteenth time!)

Okay, so I did simply what it says in the dummies' guide to PHP from php.net and created a super-simple script:

[php]<html>
<body>
<?php echo phpinfo(); ?>
<?php echo '<p>Hello world</p>'; ?>
</body>
</html>[/php]

(I added the 'hello world' part because that's exactly, by the letter, the example they use on php.net)

- and it didn't work! Typical... so now I guess I have to write to them anyway... ah well, thanks for your help anyway, guys
Possibly your host advertises PHP for some accounts, but it isn't installed on the server you are on. Strange to not have PHP in all accounts by default these days. I think that'd a valid support ticket request you have there!
     
Love Calm Quiet
Mac Elite
Join Date: Mar 2001
Location: CO
Status: Offline
Reply With Quote
May 17, 2004, 09:27 AM
 
You'll probably need to talk to them anyway to set up (and NAME) your initial DataBase in MySQL anyway. (may want to do that at same time)
TOMBSTONE: "He's trashed his last preferences"
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 17, 2004, 09:28 AM
 
originally posted by thePurpleGiant:
Possibly your host advertises PHP for some accounts, but it isn't installed on the server you are on. Strange to not have PHP in all accounts by default these days. I think that'd a valid support ticket request you have there!
Yes, they only offer PHP to Gamma, Delta and Epsilon accounts (not Alpha and Beta accounts). But I have a Delta account, so I should have it...

Originally posted by Love Calm Quiet:
<title>Test of PHP Installation via phpinfo() command</title>
<?php echo phpinfo() ?>

then when I load www.mysite.com/myphpinfo.php into safari, I get all the PHP specs on my site's server.
Well, that looks more or less like mine... (btw, the link doesn't work properly )

If you're going to mess around with this stuff at all, as a bare minimum, get one of Larry Ullman's books, like "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide"
I'd like to have some books like that - unfortunately, I can't get a hold on any... in the bookstores, they only have them in Chinese, and my Chinese is not that good; and for some reason it seems I can't buy anything online here, I've tried several times from several sites and it always gives me some kind of error message...

Also, get the free/shareware CocoaMySQL onto your Mac so you can GUI-access your data and data structure from your Mac.
I will... once I get a Mac...
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 17, 2004, 09:32 AM
 
Originally posted by Love Calm Quiet:
You'll probably need to talk to them anyway to set up (and NAME) your initial DataBase in MySQL anyway. (may want to do that at same time)
Nope, that was done automatically... (well, it says on their support pages that you have to send an email to them about setting it up and naming it, but when I did that, they wrote back saying that it was already set up and that they could access it just fine...)

P.S.: Am I the only one having problems with MacNN today??? 8 out of 10 times it times out or just does nothing; makes posting take an eternity!!!
     
Simon Mundy
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
May 17, 2004, 07:26 PM
 
Originally posted by Ois�n:
Nope, that was done automatically... (well, it says on their support pages that you have to send an email to them about setting it up and naming it, but when I did that, they wrote back saying that it was already set up and that they could access it just fine...)

P.S.: Am I the only one having problems with MacNN today??? 8 out of 10 times it times out or just does nothing; makes posting take an eternity!!!
So what did the phpinfo() script tell you? Can you post an abridged version of it?
Computer thez nohhh...
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 18, 2004, 04:56 AM
 
Originally posted by Simon Mundy:
So what did the phpinfo() script tell you? Can you post an abridged version of it?
It told me absolutely nothing, that's the problem.

It was exactly like the one I posted earlier, except that I added a simple "Hallo?" (not PHP, just plain HTML) at the end, just for reference.

When I pointed FireFox to it, it just gave me the source, exactly like posted above. In IE, it gave me a white page with the word "Hallo?" written, nothing else.

I wrote to the support team, and they checked and said that PHP was turned on on my domain, so now I'm just plain confused!

(Does it make a difference with PHP files whether you upload them as ASCII or binary? I tried both, none worked, but just for reference)
     
Simon Mundy
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
May 18, 2004, 08:50 PM
 
Originally posted by Ois�n:
It told me absolutely nothing, that's the problem.

It was exactly like the one I posted earlier, except that I added a simple "Hallo?" (not PHP, just plain HTML) at the end, just for reference.

When I pointed FireFox to it, it just gave me the source, exactly like posted above. In IE, it gave me a white page with the word "Hallo?" written, nothing else.

I wrote to the support team, and they checked and said that PHP was turned on on my domain, so now I'm just plain confused!

(Does it make a difference with PHP files whether you upload them as ASCII or binary? I tried both, none worked, but just for reference)
Could be a problem with encoding - when I had my very first php-enabled hosting space, I tried the 'Hello world' and couldn't get it to work. I rang up support and they couldn't understand why it wasn't working until they saw that the file had Mac OS style line endings (\r\n) instead of Unix (\n) - can you verify the platform your hosting is served from? Can you alter your line feed character to see if that works?

What's the address of your site - just to browse the page- can you point me to it and I'll see if there's something awry with the content type as well (I'll check it using Telnet).

Cheers
Computer thez nohhh...
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 19, 2004, 03:21 AM
 
Originally posted by Simon Mundy:
Could be a problem with encoding - when I had my very first php-enabled hosting space, I tried the 'Hello world' and couldn't get it to work. I rang up support and they couldn't understand why it wasn't working until they saw that the file had Mac OS style line endings (\r\n) instead of Unix (\n) - can you verify the platform your hosting is served from? Can you alter your line feed character to see if that works?
It's an Apache/Linux server... I'm not sure about the line feed characters, 'cause... well, I'm not sure what they are... (Should I have written some \n's in the .php file?)

Anyway, I doubt very much there's anything MacOS-ish in there, 'cause I'm on XP...

What's the address of your site - just to browse the page- can you point me to it and I'll see if there's something awry with the content type as well (I'll check it using Telnet).
Thanks! It's http://eithne.dk - the .php file is at http://eithne.dk/visinfo.php (I suppose it's safe to give you that address since it doesn't work anyway...)
     
Chris O'Brien
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
May 19, 2004, 03:43 AM
 
It does look suspiciously like apache isn't set up for php and so is serving it as text.

Have you got access to httpd.conf so you could have a look? Mine has the entropy php module loaded like:
Code:
AddType application/x-httpd-php .php
As for line endings, mac's are \r, PC's \r\n (or is the other way round) and UNIX \n.
You don't need to type them in, just save it with the correct line endings (like BBEdit ans SubEthaEdit let you do) - although, i doubt that would be the cause of this problem. I suppse you could check by writing the whole page on one line...
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 19, 2004, 04:59 AM
 
Originally posted by Black Book:
It does look suspiciously like apache isn't set up for php and so is serving it as text.
Exactly, that's what I thought! But they tell me it is set up for PHP and that PHP is turned on, etc.

Have you got access to httpd.conf so you could have a look? Mine has the entropy php module loaded like:
Code:
AddType application/x-httpd-php .php
Say what? Please remember, this is PHP for dummies 1.01 here... I have no idea what you just said...

As for line endings, mac's are \r, PC's \r\n (or is the other way round) and UNIX \n.
You don't need to type them in, just save it with the correct line endings (like BBEdit ans SubEthaEdit let you do) - although, i doubt that would be the cause of this problem. I suppse you could check by writing the whole page on one line...
I can try writing it all in just one line - I just used plain Notebook to write it and then saved it as a .php file (I saved it as UTF-8, that can't have any bad effect, can it?), so I didn't include any line break character ending thingies at all...

*goes optimistically to try the one-line thing*

Edit: No go... now it just gives me the source in one line... *sigh*
     
Simon Mundy
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
May 19, 2004, 06:23 AM
 
Originally posted by Ois�n:
Exactly, that's what I thought! But they tell me it is set up for PHP and that PHP is turned on, etc.
This is the header information from your page:-

HTTP/1.1 200 OK
Date: Wed, 19 May 2004 10:18:13 GMT
Server: Apache/1.3.27 (Unix) PHP/4.3.1
Last-Modified: Wed, 19 May 2004 09:01:56 GMT
ETag: "f263da5-89-40ab2284"
Accept-Ranges: bytes
Content-Length: 137
Connection: close
Content-Type: text/plain
X-Pad: avoid browser bug

What you SHOULD see is something like this:-

HTTP/1.1 200 OK
Date: Wed, 19 May 2004 09:59:31 GMT
Server: Apache/1.3.26 (Unix) mod_gzip/1.3.26.1a PHP/4.3.3-dev
X-Powered-By: PHP/4.3.3-dev
Last-Modified: Wed, 19 May 2004 10:11:03 GMT
Content-language: en
Connection: close
Content-Type: text/html;charset=ISO-8859-1


--> See the difference in the Content type? They've screwed up your server settings. Get on the phone and politely request they fix it immediately.
Computer thez nohhh...
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 19, 2004, 06:34 AM
 
Originally posted by Simon Mundy:
This is the header information from your page:-

HTTP/1.1 200 OK
Date: Wed, 19 May 2004 10:18:13 GMT
Server: Apache/1.3.27 (Unix) PHP/4.3.1
Last-Modified: Wed, 19 May 2004 09:01:56 GMT
ETag: "f263da5-89-40ab2284"
Accept-Ranges: bytes
Content-Length: 137
Connection: close
Content-Type: text/plain
X-Pad: avoid browser bug

What you SHOULD see is something like this:-

HTTP/1.1 200 OK
Date: Wed, 19 May 2004 09:59:31 GMT
Server: Apache/1.3.26 (Unix) mod_gzip/1.3.26.1a PHP/4.3.3-dev
X-Powered-By: PHP/4.3.3-dev
Last-Modified: Wed, 19 May 2004 10:11:03 GMT
Content-language: en
Connection: close
Content-Type: text/html;charset=ISO-8859-1


--> See the difference in the Content type? They've screwed up your server settings. Get on the phone and politely request they fix it immediately.
Okay, first of all - how the hell did you do that

Also - if I get you right, it's simply the text/plain content-type that should be text/html;charset=ISO-8859-1 (or better yet, UTF-8)? The difference in server (PHP/4.3.1 vs. mod_gzip...) and the ETag thingy don't matter?

I think I'll just mail them and include your reply

(Phoning isn't really much of an option, 'cause they're on the other side of the world)
     
Chris O'Brien
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
May 19, 2004, 07:54 AM
 
To do what Simon did you could use wget and do
Code:
wget -S --spider http://eithne.dk/
However, doing that shows that your content type is text/html now...

Code:
2 Date: Wed, 19 May 2004 11:52:08 GMT 3 Server: Apache/1.3.27 (Unix) PHP/4.3.1 4 Last-Modified: Mon, 26 Apr 2004 09:44:51 GMT 5 ETag: "f27172a-223-408cda13" 6 Accept-Ranges: bytes 7 Content-Length: 547 8 Connection: close 9 Content-Type: text/html 10 X-Pad: avoid browser bug
[edit] Silly me - I looked at http://eithne.dk/ and not the actual php page you linked to, which does show its content type as text/plain
( Last edited by Black Book; May 19, 2004 at 08:40 AM. )
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 19, 2004, 08:33 AM
 
Originally posted by Black Book:
To do what Simon did you could use wget and do (code)
Mhm... and to use wget I would need... a Mac?

However, doing that shows that your content type is text/html now...
Hmm... but the PHP still won't work...
     
Chris O'Brien
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
May 19, 2004, 08:35 AM
 
You can use wget just fine on Windows XP. Just download cygwin and install/use it from there.
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 19, 2004, 08:52 AM
 
Originally posted by Black Book:
You can use wget just fine on Windows XP. Just download cygwin and install/use it from there.
Downloading... (but I have no idea what I'm doing...)
     
Chris O'Brien
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
May 19, 2004, 09:02 AM
 
Originally posted by Ois�n:
Downloading... (but I have no idea what I'm doing...)
Cygwin is great - I use it at work where I'm forced to use windows XP...
Everything's easy to install from the setup.exe and the faq on the cygwin homepage is helpful. If you don't know how to use something, then type 'man something' without the apostrophes (where something is the name of the commandline program/tool e.g. man wget).

It's a good introduction to commandline stuff for when you finally get your mac (I'd assumed you had because your sig no longer says 'Still on Windoze')
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 19, 2004, 09:21 AM
 
Originally posted by Black Book:
Cygwin is great - I use it at work where I'm forced to use windows XP...
Everything's easy to install from the setup.exe and the faq on the cygwin homepage is helpful. If you don't know how to use something, then type 'man something' without the apostrophes (where something is the name of the commandline program/tool e.g. man wget).

It's a good introduction to commandline stuff for when you finally get your mac (I'd assumed you had because your sig no longer says 'Still on Windoze')
Nah, just decided I'd really rather not have a sig on here at all... (But I'm kind of impressed you'd remember it!)

Thanks for the 'man' tip; I have a feeling I'll be using it a lot

Still downloading... 0.5 kB/sec...
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 29, 2004, 02:10 PM
 
Okay, an update:

My PHP finally works! My host put a technician on it or something, and suddenly when I checked yesterday, it just worked! So this whole thread has been kind of... well, not necessary - but I thank you all for your help anyway!

Now I have a new problem:

Seeing as how I'm still a PHP newbie, tweaking and customising WordPress has taken me quite a while (alright, a day and a half, including an upgrade from 1.0.2 to 1.2). Now I only have two little things left that I have to do, but unfortunately those are the two things that I have no idea how to do!

1. Change the names of weekdays and months from English to Danish (I'll be blogging it in Danish). Before my little upgrade, when I was trying to figure out 1.0.2, I did it by changing them manually in wp-config-extra.php. But now that I'm trying to figure out 1.2, that option is kind of not so very existant anymore, since there is no wp-config-extra.php in 1.2. Anyone know how I can do this? I really don't want to go the whole .mo file way and translate everything, I just need the weekdays and months...

2. I have WP set up so that the index page only shows the single most recent post. Then there's the little "Comments (0)" link underneath it, and that is what I hate! I don't want to have to click that link to be able to comment, I want all the comments and the comment box to be right there underneath the post on the index page itself, just as it is when you click the link (in other words, I want it to look like this, not this when you go to eithne.dk/journal). But this has turned out to be harder than I thought! I managed to get the comment box moved over there by simply copy-pasting some of the code from wp-comments.php into index.php (it didn't even break anything), but then I noticed that it didn't really work after all - it just said "There are no comments" no matter how many comments there actually were...

If anyone can help me overcome these two little hurdles, he/she would be the hero(ine) of the day - no, make that month!

I already posted both of them over at the WP support forums, but they seem kinda slowish compared to this one (plus I know the people here, and many of them seem to be PHP gurus *tries very much in vain to conceal the &#97;ss-kissing*) so I thought I'd ask here as well...

Oh, and if anyone can make IE behave properly with CSS and generally follow the standards decently and do as it's told, he/she would also rank quite high in my esteem
( Last edited by Ois�n; May 29, 2004 at 02:19 PM. )
     
thePurpleGiant
Mac Elite
Join Date: May 2001
Status: Offline
Reply With Quote
May 29, 2004, 05:49 PM
 
Originally posted by Ois�n:
Oh, and if anyone can make IE behave properly with CSS and generally follow the standards decently and do as it's told, he/she would also rank quite high in my esteem
Hehehehe, you're funny
     
Simon Mundy
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
May 29, 2004, 08:50 PM
 
Originally posted by Ois�n:
1. Change the names of weekdays and months from English to Danish (I'll be blogging it in Danish). Before my little upgrade, when I was trying to figure out 1.0.2, I did it by changing them manually in wp-config-extra.php. But now that I'm trying to figure out 1.2, that option is kind of not so very existant anymore, since there is no wp-config-extra.php in 1.2. Anyone know how I can do this? I really don't want to go the whole .mo file way and translate everything, I just need the weekdays and months...
Try putting this at the start of your script:-

putenv("LC_ALL=da_DK");
setlocale(LC_ALL, '');

Does that work?
Computer thez nohhh...
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 30, 2004, 03:42 AM
 
Originally posted by Simon Mundy:
Try putting this at the start of your script:-

putenv("LC_ALL=da_DK");
setlocale(LC_ALL, '');

Does that work?
Hmm... which script do you mean? index.php?
     
philzilla
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
May 30, 2004, 07:14 AM
 
Originally posted by Ois�n:
Hmm... which script do you mean? index.php?
just try it and find out, man. have no fear! there comes a time when you have to think for yourself in this business, you know
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 30, 2004, 07:24 AM
 
Originally posted by philzilla:
just try it and find out, man. have no fear! there comes a time when you have to think for yourself in this business, you know
Heh... I just overcame my fears a moment ago and changed something in the get_calendar() function - the only thing I had to do was move an "echo '<td>'" two lines down and add a class to it, but it still took me six tries (out of which four made the entire site go haywire and throw a parsing error message)...

So yeah, "think for myself", I like that...

Edit: Tried putting that code in some different places in some different scripts where I thought it might have an effect - it didn't.

It looks like this is the function that's used to call the weekdays:

[php]function the_weekday() {
global $weekday, $id, $post;
$the_weekday = $weekday[mysql2date('w', $post->post_date)];
$the_weekday = apply_filters('the_weekday', $the_weekday);
echo $the_weekday;
}[/php]

Now what I don't get is where exactly it gets the names themselves from - from that mysql2date thingy (whatever that is)? Or...

This is very confused when you're PHP illiterate
( Last edited by Ois�n; May 30, 2004 at 07:32 AM. )
     
Simon Mundy
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
May 30, 2004, 07:38 AM
 
Originally posted by Ois�n:
Heh... I just overcame my fears a moment ago and changed something in the get_calendar() function - the only thing I had to do was move an "echo '<td>'" two lines down and add a class to it, but it still took me six tries (out of which four made the entire site go haywire and throw a parsing error message)...

So yeah, "think for myself", I like that...

Edit: Tried putting that code in some different places in some different scripts where I thought it might have an effect - it didn't.

It looks like this is the function that's used to call the weekdays:

[php]function the_weekday() {
global $weekday, $id, $post;
$the_weekday = $weekday[mysql2date('w', $post->post_date)];
$the_weekday = apply_filters('the_weekday', $the_weekday);
echo $the_weekday;
}[/php]

Now what I don't get is where exactly it gets the names themselves from - from that mysql2date thingy (whatever that is)? Or...

This is very confused when you're PHP illiterate
...and just as confusing when you post a snippet of code without also including the other code that relates to it - apply_filters() and mysql2date() are obviously custom functions that are defined elsewhere, so if we're going to lend a hand (or an eye or an ear) we'd need to see them as well.

EDIT:-

Ok, here's an attempt at fixing this:

[php]function the_weekday() {
global $weekday, $id, $post;
putenv("LC_ALL=da_DK");
setlocale(LC_ALL, '');
$the_weekday = strftime("%A",strtotime($post->post_date));
echo $the_weekday;
}[/php]
Computer thez nohhh...
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 30, 2004, 10:23 AM
 
Hmm... okay, substituting that seemed to do absolutely nothing at all - the dates are still in English, no difference whatsoever...

I would post the entire code, but since it's WordPress, that would mean posting like 50 PHP files in full (many of them as big as 50 kB), which would be impractical... And I don't know how to find out in which file certain functions are defined, etc.

If you're really interested, you can download the files here - that will give you a .tar.gz file containing all the files in WordPress, and you can peruse them to your heart's content

(The part I quoted above is in wp-includes/template-functions-general.php, somewhere around line 500 or so)
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 30, 2004, 11:12 AM
 
Never mind, I found it! Finally!!!

wp-includes/locale.php was the magical file... Wonder how I'd managed to completely miss the mere existence of this file for two days...
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 31, 2004, 04:50 PM
 
Update: I made it!

It took more than two weeks, but finally I seem to have a blog.

Yes!!!

After searching through what seemed like billions of lines of PHP in hundreds of files, turning grey-haired far too quickly, screaming quite a bit, some crying, and the occasional instances of having to leave the chair and go punch the wall for fear that I might otherwise punch the computer, it seems I finally managed to cut the right pieces of code into the right places on the right pages to make it look as I wanted.

And the best part is, it even works. Even in IE (although, of course, it doesn't quite look how I want it to, but can you really honestly expect it to in IE?).

Phew.

Thanks to all the contributors of this thread for being so patient with a PHP-dummy (me) and for being helpful.

Take a look at what I managed to scrape together.
     
philzilla
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
May 31, 2004, 05:12 PM
 
eh, it's all greek to me. i think you've cocked the code up.












"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Oisín  (op)
Moderator Emeritus
Join Date: Mar 2004
Location: Copenhagen
Status: Offline
Reply With Quote
May 31, 2004, 05:25 PM
 
Originally posted by philzilla:
eh, it's all greek to me. i think you've cocked the code up.
Danish is Greek to you? I think you've cocked up your geography

(Besides, both the replies to the, as yet, only post are in English. So there.)
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:21 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,