TinyPortal
Development => Support => Topic started by: JPDeni on July 10, 2006, 07:15:39 PM
What is your url? site.jpdeni.com
What error message do you get? No error message.
What version of SMF? SMF 1.1 RC2
What version of TP? v0.8.6
Which themes are used? Just the ones that came with the package
Do you have other Mods installed? No
Do you use another CMS? (Joomla or Mambo?) No
Is this a test site? Yes
I've started playing around with the php in articles thing and I'm loving it a whole lot. I keep getting more and more ideas for things I can use it for. I'm hoping to transfer another site to SMF and TP and I've got a lot of pages that I programmed over on the other site. For the most part, I'm able to just copy and paste the code from the pages into the articles and voila! -- a page. Even more important, after finding in this forum the code to allow different usergroups to view different things on the same page, I realized that I could add editing fields right on the article page.
Specifically, I've been working with a Java wordsearch applet that I implemented using php. Piece o' cake. But the puzzles are held in .txt files and I wanted to be able to create and edit the files on the same page where the game appears. I managed to create a form that only appears when an admin is viewing the page, which was very cool. The first quirk I found, though, was when I had the line
echo '</textarea>';
as part of my form. TP thought I was closing the textarea where I was editing the file and I had all sorts of trouble. I had to go into the database itself to edit the article in order to get it back. I could have done an "include" for the whole admin thing, but I really like being able to edit it right there. So I ended up using
echo '</' . 'textarea' . '>';
which TP was happy with.
I haven't been able to figure out how to fix the second quirk, though.
The wordsearch files have the following structure:
#Description of items
ITEMONE
ITEMTWO
ITEMTHREE
ITEMFOUR
etc.
I wanted to have a separate input field for the description, which I would then combine with the items when I save the file. There needs to be a newline between them. I tried using "\n", and I end up with the first line of my file being
#Description of itemsnITEMONE
(I'm getting to the question!)
I've used the "\n" structure before with php and it does exactly what it should do. I'm thinking there is something about using eval function, which I haven't used before that's causing the problem.
Or maybe it just is being ornery.
Any suggestions?
It seems that the eval function is somehow doing its own thing on certain things. I will see if I can find some info on this. It should be possible to eval even closing textareas and newlines.
Thanks so much for your reply.
It's not really *super* critical. I was able to work around it. I didn't use a separate field for the description. Workable, but not as slick as it could be. If you happen to run across an answer, I'd love to read it.
You know, for a lot of things, having these php articles is almost like being able to write unlimited modules. Very, very cool.
I solved the newline problem. Instead of using "\n" I used "\\n". I don't know why I didn't think of that before.