Template Progress

7 views
Skip to first unread message

Clark

unread,
Aug 28, 2008, 1:48:33 PM8/28/08
to myupb-de...@googlegroups.com

Just finished the header.

 

It’s hard working out what needs to go in the php file and what needs to go in the template.

 

Attached are the header template file and a sample German language file using an online translator if you’re interested.

 

Next up, the rest of index.php. Thankfully you’re able to do foreach loops in the template J

 

Clark

de_DE.xml
header.tpl

Jerroyd Moore

unread,
Aug 28, 2008, 3:07:43 PM8/28/08
to myupb-de...@googlegroups.com
Hi Clark,

For I remember what I've read about Smarty templates, you can create "blocks", correct?  Wouldn't it be much simpler to create a "block" for one forum row, and then use the foreach in the php and just create new instances of the block?

--Jerroyd Moore

2008/8/28 Clark <cl...@myupb.com>

Clark

unread,
Aug 28, 2008, 3:47:26 PM8/28/08
to myupb-de...@googlegroups.com

Yeah, I was just reading up on that at the moment as it happens.

 

Finally reached the penultimate chapter of the Smarty book I bought J

 

Having trouble with umlauts and other special characters in the translation files but I’ve posted a question on a forum which should give a response.

 

Clark

 


Jerroyd Moore

unread,
Aug 28, 2008, 4:58:37 PM8/28/08
to myupb-de...@googlegroups.com
Looking at the header, if you want my advise, I might look into making two header files: one for people logged in, and one for people logged out.  The immediate benefit is that users could customize a header with specific links for guests and a different set of links for users.  You can even make a third one for admins.  For admins, you could add a table to see if any newly registered users need approval, etc.  Take my suggestion with a grain of salt though.  It's your project, so you do it how you think is best.

--Jerroyd Moore

Clark

unread,
Aug 28, 2008, 5:25:23 PM8/28/08
to myupb-de...@googlegroups.com

I think I’ll convert all the existing pages first and then think about splitting the header templates etc.

 

I’m enjoying this. It’s like learning a new programming language all over again. I even made the noobish mistake of spending half an hour trying to work out why some translated text wasn’t showing. I gave up went to bed, woke up the next morning, opened the file and there was a $ missing…..D’oh. We’ve all been there J

 

As for the problem with the umlauts etc. I got a quick response. I was saving the xml files in the wrong format – they were being saved as ANSI files rather than UTF-8 files.

 

It’s a shame you just can’t pass some English into a function and it’ll translate it into any language. One day perhaps.

 

Take care

Jerroyd Moore

unread,
Aug 28, 2008, 5:55:39 PM8/28/08
to myupb-de...@googlegroups.com
For the umlauts thing, if you use a program called Notepad2 for the Windows OS, you can easily change the encoding from ANSI to UTF or anyother encoding for that matter.  It's as simple as a click of the button.  If you already found a way to convert it, then delete this e-mail :)

Clark

unread,
Aug 28, 2008, 6:31:28 PM8/28/08
to myupb-de...@googlegroups.com

Got it working. Just checked the help file of the editor I use J

Clark

unread,
Sep 1, 2008, 6:55:26 AM9/1/08
to myupb-de...@googlegroups.com

Managed to get the block thing working fine. Templated all the error messages etc. and it’s looking good.

 

Onto viewforum.php

 

The toughest bit is going to be the AJAX and Javascript. I’ll cross that bridge when I come to it.

 

Clark


From: myupb-de...@googlegroups.com [mailto:myupb-de...@googlegroups.com] On Behalf Of Jerroyd Moore
Sent: 28 August 2008 20:08
To: myupb-de...@googlegroups.com
Subject: [myupb-developers:53] Re: Template Progress

 

Hi Clark,

Jerroyd Moore

unread,
Sep 2, 2008, 5:34:07 PM9/2/08
to myupb-de...@googlegroups.com
Ah, good work :)

For Ajax, I have a theory on how to implement it.  If I'm correct in assuming that ajax works by saving the text in a variable and then printing it at the right time (based on sniffing through the ajax.php), the ajax code should look exactly the same as the newpost.php, editpost.php, etc.

I'm not sure if Smarty prints the HTML right away.  If so, you can capture output into a variable by using this PHP API: http://php.net/ref.outcontrol

Eventually, I'd like to get rid of ajax.php, and merge the functionality into the PHP files that generate the content (better programming practice), but that's def. the next rev.

Clark

unread,
Sep 3, 2008, 5:49:55 AM9/3/08
to myupb-de...@googlegroups.com

Hi Rebles,

 

Yeah that could be done. Hopefully a large chunk of the code will disappear from ajax.php with the templating which should make it easier to move about.

 

You’re right about the ajax method. There is however a fetch method for smarty which processes the variables and the template but doesn’t display them.

I haven’t had to use it yet but it might be the solution.

Reply all
Reply to author
Forward
0 new messages