Editing .tpl files

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
neov
Regular
Posts: 23
Joined: Fri May 26, 2006 1:41 pm
Contact:

Editing .tpl files

Post by neov »

Is there an easy way to do this besides going in manually? It seems that the only way I've found is to go in, edit something, transfer it to the server, and see what I end up with.

Another problem I have with this is that my changes often times look different in IE than it does in Mozilla or Netscape.

For example, when trying to edit out the comments and trackback sections in a category and putting in a link to my forum instead, I sometimes get this:
To leave a comment, please visit our forum

The author does not allow comments to this entry
-->


Frontpage - Top level
The part I don't want is in blue, and it sometimes shows up in Mozilla and not IE, or vice versa.

My receding hairline is receding even more rapidly while trying to figure this out, so any help would be appreciated. :wink:
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Editing .tpl files

Post by garvinhicking »

Hi!

No, there is no "frontend" for editing files. This has two reasons:

1. Any decent editor is MUCH better than just a textarea in your browser. Syntax highlighting, autocompleteion etc. is VERY important for successfull coding.

2. Security issues. It would mean that many of your files would need to be writable by the PHP process, plus if someone hacked your s9y interface, he could put any PHP code onto your blog. Currently, if someone has hacked your s9y installation (by getting your password somewhere), it would not necessarily imply that he could alter/edit files on your webspace.
Another problem I have with this is that my changes often times look different in IE than it does in Mozilla or Netscape.
Yes, it's like that. IE has many CSS oddities. You'll always face these problems with HTML webdesign. :)

Your snippet of code shows that you seem to have moved pieces of the .tpl files outside of their foreach loops. Always pay attention that when you move blocks to check their IF/FOREACH structure.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
neov
Regular
Posts: 23
Joined: Fri May 26, 2006 1:41 pm
Contact:

Post by neov »

At the risk of sounding completely ignorant, what's a foreach loop? Perhaps you know of a good tutorial I should look at?

Thanks Garvin. I know dealing with newbies like me must be frustrating at times.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

A foreach loop is a bunch of stuff (the "loop") that gets done once "for each" entry in a list. You just specify the list and what to do with each entry.

For a slightly more detailed explanation of how Smarty works with Serendipity, you might like to look at this Editing entries.tpl template tutorial on the main page.

If you have any other questions, feel free to ask.
Judebert
---
Website | Wishlist | PayPal
neov
Regular
Posts: 23
Joined: Fri May 26, 2006 1:41 pm
Contact:

Post by neov »

Believe it or not, I think it's starting to make sense...

I started to look closely at where I'd put the <!-- and --> to stop the comments, trackbacks, etc. and realized what Garvin was saying and how I wasn't doing what I was supposed to do, I think. I just made some more changes, and it seems way easier this time.

Should I be afraid now? ;)

Thanks for the link to the tutorial. I'm sure that will help as well. :D
Last edited by neov on Wed Jun 07, 2006 4:12 am, edited 1 time in total.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Be afraid. Be very afraid. :lol:

Once it starts to make sense, the urge to make modifications becomes overpowering. That leads to overreaching the limits of HTML, which leads to frustration, which leads to pain. Pain leads to hate. Hate leads to... suffering. :roll:

Seriously, though, congratulations. You're on your way. And we're always here to help you, if you need it.
Judebert
---
Website | Wishlist | PayPal
Post Reply