Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Hacks and Modifications

Post Reply
 
Thread Tools
  #1  
Old 07-09-2005, 03:48 PM
riken Offline
pp veteran
 
Join Date: Apr 2005
Location: In VB Hell!
Posts: 87
Smarty

Has anyone considered using Smarty instead of search/replace for template handling?
__________________
Riken
Photoblog: Distant Imagery
Reply With Quote
  #2  
Old 07-09-2005, 04:09 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
nice stuff.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
  #3  
Old 07-18-2005, 06:31 AM
riken Offline
pp veteran
 
Join Date: Apr 2005
Location: In VB Hell!
Posts: 87
Thanks.

Do any of the other developers have an opinion on this? Any reason not to use smarty?

I'm currently knocking up a version of pixelpost using smarty, to see how easy/hard the conversion is. If people are interested I can post it here when it's finished.
__________________
Riken
Photoblog: Distant Imagery
Reply With Quote
  #4  
Old 07-18-2005, 06:53 AM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
Doen't it make creating templates harder for ordinary users?
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
  #5  
Old 07-18-2005, 07:07 AM
Connie
Guest
 
Posts: n/a
I think it is not so much the problem now

why should we change something what is working for us?
there are other things which are more important:

new functionalities for example

we are all volunteering and I think we must not do work twice just to change the engine behind

and all AddOns which are out also must change

I do not see any sense in converting just for fun, if there are no basic reasons which urge to change something

and: there are many template - thingies out there, smarty and many others
so the next proposition will be to use another thing.. and what is the gain of functionality for this? I see nothing

and to be frank: I do not like to turn myself in a circle...
I like to go ahead, and if I work on something, it should make sense, give something new...

and please do not post any things like that here, (my opinion), we will run into a absolutely fruitless discussion. (catholic or protestant, white or green, apples or oranges)

we should devote our skills to productive things

As I can say:

do something productive
love it or leave it (I saw this on american bumperstickers) :wink:
if you like to do something for your pleasure, do it
if that is making our way here problematic, leave it
never change a running system

and so on

I am absolutely not willing to discuss these things: why do you it this way and not this way? But I want it to be this way...
for that my time is too valuable
Reply With Quote
  #6  
Old 07-18-2005, 07:46 AM
riken Offline
pp veteran
 
Join Date: Apr 2005
Location: In VB Hell!
Posts: 87
Quote:
Originally Posted by raminia
Doen't it make creating templates harder for ordinary users?
Only if the more advanced smarty tags are used.

Quote:
Originally Posted by connie
why should we change something what is working for us? <snip>
Good point.

My only problem with the way it currently works is that, because the addons are run after the tags are searched/replaced, it's impossible to create addons that add to the template.

For example, I created an addon that would insert a template within another template (like the header/footer, but more generic). The addon worked, but the file being inserted couldn't have any pixelpost tags because they wouldn't get replaced. A templating engine would solve that problem.

I can post the addon once I get home from work. It was only about 5 lines.

Also I found this http://www.massassi.com/php/articles/template_engines/ which has a nice small template class.

Basically the problem I had with the addon could be fixed by doing all the tag replacement at the end of the processing, instead of in the middle, and before the addons are processed.

So I did have a reason for asking about templates Thanks for the reply.
__________________
Riken
Photoblog: Distant Imagery
Reply With Quote
  #7  
Old 07-18-2005, 07:59 AM
Connie
Guest
 
Posts: n/a
Quote:
Basically the problem I had with the addon could be fixed by doing all the tag replacement at the end of the processing, instead of in the middle, and before the addons are processed.
That's the real point and that's on the list already.
We are aware of that and want all tags at hand in any template and that's why we put this topic already in the pipeline 8)

so you see, it's on the way.
Reply With Quote
  #8  
Old 07-18-2005, 11:15 AM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
Quote:
Originally Posted by Connie
I think it is not so much the problem now

why should we change something what is working for us?
Yes it's not the problem now but I'm looking for the future.
The things we are using now may become obsolute if you don't track the user trends and changes.

Smarty is good for developper and I know it is excellent in that point but I still think it is more complicated than the simple HTML tags of PP. (That's a big superiority)

Do you think with this little modification poeple will abandon the PP dev streamline and leave all those templates and stuff and go with smarty? I don't think so. Let poeple think intutive. If we, dev team, want to guide the modifications we can assign open chanllenges that are critical for PP and ask people to work on it.

I think the main issue now is Templates but not smarty! Different, good templates for different tastes. I think poeple in the forum do not have a clear image of what we are doing. there should be some 'news' section in the site for that. Without that you could not expect poeple to underestand your longly debated concerns in the dev team!
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
  #9  
Old 07-18-2005, 02:08 PM
riken Offline
pp veteran
 
Join Date: Apr 2005
Location: In VB Hell!
Posts: 87
I totally agree with you Raminia

Ok, so I've written a template engine for pixelpost, that works with the existing tags.

The template class is here: http://www.distantwisdom.net/~camero...ate.class.phps

The modified index.php is here: http://www.distantwisdom.net/~camero...ost/index.phps (it's based on the one in CVS, with some modifications I made )

The site is here: http://www.distantwisdom.net/~cameronm/pixelpost/

The main modification is to the str_replace and egrep_replace calls. Instead of

Code:
$tpl = str_replace('<SITE_TITLE>', $title, $tpl);
we have

Code:
$tpl->set('<SITE_TITLE>', $title);
The example I've used above calls the engine to render the result *before* the addons are called, so that it's backwards compatible. To take advantage of the template engine properly, the addons would have to be changed as detailed above aswell.
__________________
Riken
Photoblog: Distant Imagery
Reply With Quote
  #10  
Old 07-18-2005, 04:14 PM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
In some pages the EXIF data is broken or invalid. the page is not loading completely. thumbs are not shown. btw, the EXIF data is not there but the tags are there
EXIF_EXPOSURE_TIME
EXIF_APERTURE
EXIF_CAPTURE_DATE
EXIF_FOCAL_LENGTH
EXIF_CAMERA_MAKE
EXIF_CAMERA_MODEL
EXIF_ISO
EXIF_FLASH
LANG_EXPOSURE_TIME
LANG_APERTURE
LANG_CAPTURE_DATE
LANG_FOCAL_LENGTH
LANG_CAMERA_MAKE
LANG_CAMERA_MODEL
LANG_ISO
LANG_FLASH

I think you didn't want them to be like this.

EDIT:
The problem is use of str_replace in template class. replace it with ereg_replace to work correctly.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 02:05 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs