Hi all,
I'm new to Serendipity and am familiarizing myself with the codebase. First, let me say congratulations on a fine Web application - keep up the good work!
Just wondering if there is a consistent way to change the value of constants rather than simply replacing them where they appear. For example, if you want change a string of text from "the" to "and" you could go into the template and edit the {$CONST.XXX} with what you want to show. Is there a central repository for all these with the default distribution?
I have searched around the forums/Internet with no luck yet.
Best regards
Rodney
Constant values through the s9y code?
Constant values through the s9y code?
Here's an example from comments.tpl...
$CONST.NO_COMMENTS ???
and
$CONST.ANONYMOUS ???
I understand they can be replaced with specified content of your choosing but I'm wondering where they come from in the first place. Is there a central repository of constant values?
Best regards,
Rodney
Code: Select all
<div class="serendipity_center">{$CONST.NO_COMMENTS}</div>
and
Code: Select all
{if $comment.email}
<a href="mailto:{$comment.email}">{$comment.author|@default:$CONST.ANONYMOUS}</a>
{else}
{$comment.author|@default:$CONST.ANONYMOUS}
{/if}
I understand they can be replaced with specified content of your choosing but I'm wondering where they come from in the first place. Is there a central repository of constant values?
Best regards,
Rodney
Ah Ok,
Ok hopefully this answers your question.
tpl are smarty files, they just relay information at run time from the php files. They are like the clock face behind the gears.
The info your looking for is in the application itself. Gavin developed S9Y with templating in mind to change S9Y your looking to tinker with the backend.
In order to find what your looking for your gona need a multi-file finding app. I dont know what your use for editing, I use Editplus but basically search ALL files in s9y for the const.
I dont know if there are debuggers with php or not, that might also help you.
Ok hopefully this answers your question.
tpl are smarty files, they just relay information at run time from the php files. They are like the clock face behind the gears.
The info your looking for is in the application itself. Gavin developed S9Y with templating in mind to change S9Y your looking to tinker with the backend.
In order to find what your looking for your gona need a multi-file finding app. I dont know what your use for editing, I use Editplus but basically search ALL files in s9y for the const.
I dont know if there are debuggers with php or not, that might also help you.
Thanks for that reply.
Hmmm... having to manually search through all the s9y files seems like a strange way to locate const values...
I mean, if that is the case the values themselves may as well be statically coded into the template... or am I missing something about these $CONST things that provides a more overall meaning?
Best regards,
Rodney
Hmmm... having to manually search through all the s9y files seems like a strange way to locate const values...
I mean, if that is the case the values themselves may as well be statically coded into the template... or am I missing something about these $CONST things that provides a more overall meaning?
Best regards,
Rodney
-
stm999999999
- Regular
- Posts: 1531
- Joined: Tue Mar 07, 2006 11:25 pm
- Location: Berlin, Germany
- Contact:
Re: Constant values through the s9y code?
these are (in most cases?) language constants.rodney wrote: $CONST.ANONYMOUS ???
I understand they can be replaced with specified content of your choosing but I'm wondering where they come from in the first place. Is there a central repository of constant values?
They are defined in lang/serendipity_lang_xx.inc.php
e.g.
Code: Select all
@define('ANONYMOUS', 'Anonymous');
So, do this:
Add your own language definitions in your choosen template directory:
e.g. lang_en.inc.php
normaly this file is only for definitions especial for constants only used in this very template and not for definitions which occurs in the normal lang-file (the template-lang-file cannot override the normal definitions).
But there is a way to make your own language definitions. I is not experimental, it works well, but it is not promoted, yet:
in serendipity_config_local.inc.php
add at the end:
Code: Select all
// End of Serendipity configuration file
// You can place your own special variables after here:
$serendipity['useTemplateLanguage'] = true;
?>Ciao, Stephan
Hi,
can I also define _new_ words in the template lang_xx.inc.php file?
I'm asking, because if I write this:
the predefined DONE is evaluated well in all languages, but CONTACT is just recognized in english.
my lang files are like this:
and I ripped the config.inc from the kubrick theme:
I added this line to the config.local.inc.php
I'm terribly sorry asking this, but I searched overall the forum and docs but haven't found any relevant answer; and checked the syntax a hundret times
I also tried to add the defines to the lang/serendipity_lang_xx.inc.php files, but they weren't recognized there, too... hummm
I'd be really thankful for a small hint!
Thanks alot,
Michael
can I also define _new_ words in the template lang_xx.inc.php file?
I'm asking, because if I write this:
Code: Select all
<li>{$CONST.CONTACT}</li>
<li>{$CONST.DONE}</li>
my lang files are like this:
Code: Select all
<?php
@define('START', 'Start');
@define('FORUM', 'Forum');
@define('SCHEDULE', 'Kalender');
@define('GALLERY', 'Gallerie');
@define('CONTACT', 'Kontakt');
@define('IMPRINT', 'Impressum');
?>
Code: Select all
<?php # $Id: config.inc.php 108 2005-05-19 08:40:00Z garvinhicking $
$probelang = dirname(__FILE__) . '/lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
include $probelang;
} else {
include dirname(__FILE__) . '/lang_en.inc.php';
}
?>
Code: Select all
$serendipity['useTemplateLanguage'] = true;I also tried to add the defines to the lang/serendipity_lang_xx.inc.php files, but they weren't recognized there, too... hummm
I'd be really thankful for a small hint!
Thanks alot,
Michael
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi mima!
Could you show us your complete *.php files in your template directory? My guess is that not all files contain the constant declaration? And maybe you are missing the "UTF-8" subdirectory PHP files to add your constants to?
Best regards,
Garvin
Could you show us your complete *.php files in your template directory? My guess is that not all files contain the constant declaration? And maybe you are missing the "UTF-8" subdirectory PHP files to add your constants to?
Best regards,
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/
# 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/
arghgarvinhicking wrote:Hi mima!
And maybe you are missing the "UTF-8" subdirectory PHP files to add your constants to?
as always when I'm posting to forums, the answer is easy and a bit embarrassing to me
Thank you for that wonderful peace of software!
(I am so sad, that my private blog runs with WP; since I installed s9y for our university class homepage, I am missing all those cool s9y features...
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Great we could solve this portion of your problem(s).
Nice to hear you enjoy serendipity! Spread the word
Best regards,
Garvin
Great we could solve this portion of your problem(s).
Nice to hear you enjoy serendipity! Spread the word
Best regards,
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/
# 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/