Best way to edit page content
The home page for my forums is set to "categories" which shows a title of "All Categories" and then a list of the available categories.
- Heading: All Categories
- Category List
I would like to change the page title to be "Forums" and then insert a paragraph of text welcoming users and providing some simple instructions. Only after this would I like a heading of "Categories" to appear and the list of categories themselves.
- Heading: Forums
- Welcome
- Heading: Categories
- Category List
After trawling the forums I found that I could copy a file called all.php from the vanilla/views/categories folder into my theme/views/categories folder and edit that to get the desired effect. The downside of this seems to be that whenever I update vanilla I will need to check the new original file for changes and duplicate them into my tweaked file. Is there a better way to be doing this that is more modular? Also, where would I edit the default page title and description that are referenced in all.php
echo '<h1 class="H HomepageTitle">'.$this->Data('Title').'</h1>'; if ($Description = $this->Description()) { echo Wrap($Description, 'div', array('class' => 'P PageDescription')); }
At the moment I have just commented these out and replaced them with static text like this..
echo '<h1 class="H HomepageTitle">Forums</h1>';
Thanks a lot
Alan
Best Answers
-
peregrine MVP
there are 3 values that show "titles and descriptions
$Configuration['Garden']['Title'] = 'Vanilla 21 Top Title';
$Configuration['Garden']['HomepageTitle'] = 'Vanilla 21 Home Page Title';
$Configuration['Garden']['Description'] = 'here is my description';
if homepagetitle is blank it uses its own Title
"All Categories" on the categories page, which can be altered via definitions.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
5 -
peregrine MVP
you could use pocket above content all pages
and then alter via a similar manner (with in section or via css).
http://vanillaforums.org/discussion/22082/have-a-pocket-showing-only-on-home-page
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
5 -
R_J Admin
If you prefer to reduce that div to a Smarty call, I would reduce it some more:
function smarty_function_categorieslist_welcome($Params, &$Smarty) { if InSection("CategoryList") { $Result = '< div class="ForumWelcome"> < h1 class="H ForumWelcomeTitle">Forums< /h1> < div class="P ForumWelcomeText"> < p>Hello< /p> < /div> < /div>'; return $Result; } }
Now you can simply enclose
{CategoriesList_Welcome}
in your template.5
Answers
I would avoid copying views like all.php - you will have a nightmare on your hands, during upgrades as you said and you also may not achieve the benefits of security fixes and new fireevent tirggers, etc, if it beocmes stale during the upgrade process.
use a combo of plugin, themeoptions, or definitions, and or config settings. and pockets plugin and or messages from dashboard.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
see this comment
http://vanillaforums.org/discussion/comment/214522/#Comment_214522
and following comments in the thread i linked.
and
http://vanillaforums.org/discussion/26597/tutorial-how-to-change-wording-how-to-change-text-how-to-change-language-how-to-change-locale
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
there are 3 values that show "titles and descriptions
$Configuration['Garden']['Title'] = 'Vanilla 21 Top Title';
$Configuration['Garden']['HomepageTitle'] = 'Vanilla 21 Home Page Title';
$Configuration['Garden']['Description'] = 'here is my description';
if homepagetitle is blank it uses its own Title
"All Categories" on the categories page, which can be altered via definitions.
http://vanillaforums.org/discussion/26597/tutorial-how-to-change-wording-how-to-change-text-how-to-change-language-how-to-change-locale
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Wow that is awesome, thanks. I don't know whether to be happy at how easy you made it or depressed that I wasted hours trying to do it the hard way If only I chosen the right search terms!
That has got the page heading and description sorted, the only thing left now is to insert a heading above the categories list (since the original All Categories has been replaced by changing the HomepageTitle to Forums. As this is a whole new entry and not an edit of an existing item I assume it will be more complicated? Would I need to capture a rendering event and insert the heading as part of a function?
post a screenshot and an arrow pointing to what you want to achieve.
a picture is worth a thousand words
pockets plugin or dashboard messages might do it for you. but I can't visualize what you want.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
you could use pocket above content all pages
and then alter via a similar manner (with in section or via css).
http://vanillaforums.org/discussion/22082/have-a-pocket-showing-only-on-home-page
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Sorry for the delay, family life intervened
Ignoring any formatting, in terms of content I want to take something like this...
and change it into this
I'll dig into the plugin you mention and see if I can use it to do what I need
Thanks again for all your help
Alan
I managed to do every thing I need with pockets and a few changes to CSS and default.master.tpl so thanks so much for the heads up!
At the moment I am inserting the HTML I need at the top of the All Categories page (which is my homepage) by defining the HTML in a pocket called "HomepageWelcome" and adding the following to my default.master.tpl
I was just wondering...is it possible to instead use a custom Smarty Function to return a HTML blob as I could just use something like this instead (and not have to run pockets)
I started trying to create a function but wasn't sure how (or if it was even possible) to return the html text string I created as the functions I looked at all called a specific method to return the code (e.g. Breadcrumbs)
return Gdn_Theme::Breadcrumbs($Breadcrumbs, FALSE);
I can certainly get away with using pockets but I always tend to like to use the fewest plugins possible so if there is a simpler way...
I did try to decipher the pockets plugin to see how it was doing things but it is a bit beyond my php/vanilla skills at the moment.
Thanks
Alan
Came up with this as a function, is it legit? It seems to work...
Thanks
Alan
If you prefer to reduce that div to a Smarty call, I would reduce it some more:
Now you can simply enclose
{CategoriesList_Welcome}
in your template.Ah much cleaner, thanks
Just moved the title and text into the definition file and now I think it is pretty good