Is it okay to import 'controllers' into custom theme just like 'views'?
The documentation says that all application 'views' can be moved to a custom theme:
Master Views: These represent everything that wraps the main content of every page. If all you want to do is add a menu or banner above Vanilla, this is the only file you will need to alter. To do so, copy the default master view from /applications/dashboard/views/default.master.php to /themes/your_theme_name/views/default.master.php and edit it there.
Views: These represent all of the content in each page. Every application has a "views" folder that contains all of the html for every page. So, for example, if you wanted to edit the html for the discussion list, you could copy the views from /applications/vanilla/views/discussions to /themes/your_theme_name/views/discussions and edit them there.
Does this apply to the 'controllers' as well? For example, can I move /applications/dashboard/controllers/class.entrycontroller.php to /themes/[custom theme]/controllers/class.entrycontroller.php ? Is it going to work?
Hope to see someone knowledgeable clarify on this. Thanks.
Best Answers
-
x00 MVP
no, definitely not. This is bound to end in tears. This why you extend with
even with views, there is some risk of redundancy, and errors when you update becuase it could be referencing an object that is no longer used. However, generally it is ok if you are aware. This becuase view are supposed to be logic light. It should only to be to do with the direct display (however the line is quite grey, and it is not always possible).
grep is your friend.
1 -
x00 MVP
in
/locales/YourLocale/definitions.php
<?php if (!defined('APPLICATION')) exit(); $LocaleInfo['YourLocale'] = array ( 'Locale' => 'YourLocale', 'Name' => 'Your Locale', 'Description' => 'Your Locale', 'Version' => '1.0.1b', 'Author' => 'Your Name', 'AuthorEmail' => 'your@email.com', 'AuthorUrl' => 'http://vanillaforums.org/profile/yourname' ); $Definition['Follows']='Stalkers';
then follow the instruction on how to enable. It si also a good idea to copy the definitions from
forumtest/applications/dashboard/locale/en-CA/definitions.php
to your locale.grep is your friend.
1 -
peregrine MVP
Clear Documentation thanks.
An alternate way that was pointed out to me by @Lincoln.
http://vanillaforums.org/discussion/comment/155751#Comment_155751
If you are only changing a few definintions, you could modify the locale.php in the conf directory and just add these two lines. Don't know which is the preferred way.
# $Definition['Bookmark'] = 'Follow Discussion'; # $Definition['Unbookmark'] = 'Unfollow Discussion';
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
1 -
peregrine MVP
I was just going to write that "It probably will get overwritten in an upgrade"
I just make a copy of it and call it "updated-locale.ph" leaving off the letter in the extension, so it doesn't fire off or interfere with the main one.
Then I will go through the directories and look for update and diff the changes, after an upgrade.I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
1 -
Linc Admin
Missed this, sorry. You can safely ignore the conf/locale.php file when upgrading. I'm not sure why that's even in core.
1
Answers
no, definitely not. This is bound to end in tears. This why you extend with
even with views, there is some risk of redundancy, and errors when you update becuase it could be referencing an object that is no longer used. However, generally it is ok if you are aware. This becuase view are supposed to be logic light. It should only to be to do with the direct display (however the line is quite grey, and it is not always possible).
grep is your friend.
Oh, okay. Here's the thing @x00 — I am trying to change the title attribute of the 'Follows' box added by ('Voting' plugin) from "Bookmark" and "Unbookmark" to "Follow Discussion" and "Unfollow Discussion" — the thing is, it's being changed by some JavaScript or Ajax function (aside from the PHP in a view file - for changes in real-time without browser refresh), which I am unable to find even using grep.
Can you try to help me with that?
-
grep is your friend.
No. I don't know what that is. Can you try to be more clear? (locale definition? Where should I look for it?)
ok had a look at the voting plugin it is there
T('Follows')
look up locales in the documentation.
grep is your friend.
http://vanillaforums.org/docs/localization
grep is your friend.
@x00 : Yeah, looking right at it. I don't know how to code in PHP, but I hope my common sense helps, as it has so far.
@x00 : The documentation doesn't make sense to me at all — it isn't clear. Can you please explain to me in simple words (& if possible precisely) as to what I should do?
If you can't do the above (i.e. if what I asked is not easy to explain) I plan to follow this (but I hate to have to use yet another plugin on my site). Should I?
I am reading the documentation all over again though... just in case it starts to make sense all of a sudden.
in
/locales/YourLocale/definitions.php
then follow the instruction on how to enable. It si also a good idea to copy the definitions from
forumtest/applications/dashboard/locale/en-CA/definitions.php
to your locale.grep is your friend.
@x00 : Thanks a lot. The documentation is clear as well, I should have read it more carefully and slowly.
Let me see if I can pull it off — if I do, there'll be a very clear 'how-to' explanation here shortly for everyone else
And... It would be great if someone (who can) can add this to Vanillaforums.org's custom.css file:
I pulled it off! Here's the how-to for everyone as I promised...
[1] Go to
/locales
directory right inside your Vanilla forum's root directory.[2] In
/locales
create a directory/MyLocaleChanges
(name's your choice)[3] Into
/MyLocaleChanges
upload a file named 'definitions.php' with the following content:As you can see, the last two lines were added my me. Now, "Bookmark" gets translated to "Follow Discussion", and so on.
[4] Now go to
Dashboard > Locales
and enable 'My Locale Changes.'[5] That's all, but the definitions in captured.php file in Baseline Locale Addon will be a good reference when you want to confirm if you are replacing the right term.
Hope I'm clear enough. Special thanks to @x00 !
Clear Documentation thanks.
An alternate way that was pointed out to me by @Lincoln.
http://vanillaforums.org/discussion/comment/155751#Comment_155751
If you are only changing a few definintions, you could modify the locale.php in the conf directory and just add these two lines. Don't know which is the preferred way.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thanks @peregrine that'll help. But do you know if the custom definitions in locale.php get overridden when Vanilla is updated?
I was just going to write that "It probably will get overwritten in an upgrade"
I just make a copy of it and call it "updated-locale.ph" leaving off the letter in the extension, so it doesn't fire off or interfere with the main one.
Then I will go through the directories and look for update and diff the changes, after an upgrade.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine : Nice suggestion. It's always good to have a choice. Thanks!
(Well, as you can see, this question has hell a lot of answers!)
also, if the definitions don't seem to take effect after changes to locales
I believe deleting the /cache/locale_map.ini file will fix the problem.
I am just a novice at this, and I would certainly defer to the suggestions by the experts.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Yep. I read that here just before wrote.
conf/locale.php is not distributed with Vanilla, so no, it will not get overridden.
@Lincoln : Thanks for the tip!
@peregrine : Just wanted to let you know (see Lincoln's comment).
If I look at vanilla-core-2-0-18-3.zip, I can see conf/locale.php inside. Wouldn't this mean it would be overwritten or am I missing something?
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.