Web-designer having trouble with php to .txt function!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shaun Guyver
Forum Newbie
Posts: 3
Joined: Sat May 13, 2006 9:27 am

Web-designer having trouble with php to .txt function!

Post by Shaun Guyver »

Hi, I'm new to this forum but I'd greatly appreciate some help.

Most of the web-sites I design have news sections. Currently they work in that I create a dynamic text box in flash, populate it with text by linking it to a html file in the same directory, and give it styles by linking it to a css file in the same directory also.

At present, the dynamic text box in flash knows which bits of text to assign which style to as I specify them in the html file, as follows;

<body>
<header>We have a new shop opening in Hammersmith!</header>
<date>15th May 2005</date>
<main_text>blah blah blah blah blah</main_text>
</body>

The css tags "header", "date" and "main_text" are specified in the css file. So, that works fine and it looks great. However, I have re-designed this process so that I simple fill in a php form, with three text fields for the header, the date, and the main text, click a submit button and it opens a .txt file and writes to it using the fopen, fwrite and "a" (append) functions. The .txt file is then closed and saved and the php page I have just filled in refreshes. This works great and I have linked the dynamic text box in flas to the text file, and it displays all the text I input into the form superbly.

However there are no styles and it just looks ugly! Is there any way for me to include styles in this process, so that the end result in the dynamic text box in flash not only displays text but also displays styles?

I am desperate for this to be finished so my clients can start updating their sites themselves. Here is a zip file containing the files mentioned above, so you can have a look for yourself.

http://www.officialryantaylor.com/php.zip

Also, if anyone knows someone who provides a service that could resolve this problem I'd be happy to pay. Even happier of course if it could be resolved here!

Thanks
User avatar
tasteslikepurple
Forum Commoner
Posts: 46
Joined: Thu Jan 26, 2006 3:38 am
Location: Bath, UK

Post by tasteslikepurple »

I clicked on the link but it was a 404 error.

Does the text file get the header (and other) tags put in too (i assume it does :))

if so, i would guess that maybe it's a problem with the flash if you're using actionscript. maybe you need a loop in there somewhere to iterate over each news item.

anyway, if you get a link that's working up, i'll take a look and try to fix it for you :)
Shaun Guyver
Forum Newbie
Posts: 3
Joined: Sat May 13, 2006 9:27 am

Post by Shaun Guyver »

The link is working now! Sorry about that.

At the moment the tags don't get put in, I tried that but it created problems, either there would be no data written to the text file at all or it would multiply the data for some strange reason.
User avatar
tasteslikepurple
Forum Commoner
Posts: 46
Joined: Thu Jan 26, 2006 3:38 am
Location: Bath, UK

Post by tasteslikepurple »

cool, i'll take a look at it now

edit: fixed it. you can find it at http://www.cmwc.co.uk/php.zip

p.s. if you ever need a php developer, I'm looking for work :wink:

any problems and let me know and i'll fix them
Shaun Guyver
Forum Newbie
Posts: 3
Joined: Sat May 13, 2006 9:27 am

Post by Shaun Guyver »

I'm launching my own web-design service this summer before I go off to university. While I'm learning php at the moment, I'll definitely need someone to do a few jobs for me in the mean-time, which I will store, modify and use again for other projects (why reinvent the wheel?).

My e-mail address is info@guyverdesign.com so if you could just contact me and I'll store ur address until I need something done.

Also, the text looks great thanks, but is there a way of making the fwrite function perform this action upside down? In other words, so that the newest information appears ontop?
User avatar
tasteslikepurple
Forum Commoner
Posts: 46
Joined: Thu Jan 26, 2006 3:38 am
Location: Bath, UK

Post by tasteslikepurple »

i'll get onto it, will post it up tomorrow.
ablaye
Forum Newbie
Posts: 13
Joined: Sun May 14, 2006 9:26 pm

Post by ablaye »

Shaun Guyver wrote:I'm launching my own web-design service this summer before I go off to university. While I'm learning php at the moment, I'll definitely need someone to do a few jobs for me in the mean-time, which I will store, modify and use again for other projects (why reinvent the wheel?).
If you ever need help, hit me up.
User avatar
tasteslikepurple
Forum Commoner
Posts: 46
Joined: Thu Jan 26, 2006 3:38 am
Location: Bath, UK

Post by tasteslikepurple »

have emailed you the new file. hope it's ok!
Post Reply