Customizing SMF > SMF Coding Discussion
Need to change the contents of this one table. Need help ASAP
Groovystar:
I finally found what needs to change but I don't know how to change it.
Here's the code in index.template.php:
--- Code: ---// Time for the our news!
echo'<div class="pnl"><div class="newsDiv">
<div class="newsText">
', (!empty($modSettings['news_text']) ? parse_bbc($modSettings['news_text']) : ''), '
</div>
</div>';
// If the user is logged in, display stuff like their name, new messages, etc.
--- End code ---
It produces the text that gets dropped into my custom newstext area on every page of my site,under the logo and menu on the right side {the right one of two twin tables}. I want to change what text and links are shown in it but I don't know how. It's calling it from the database and I know how to go in and change it there, but that would only change it for every single theme I have.
I need a little help on this ASAP please....I don't care what method I wind up needing to use I just need to be able to change it. I would try just putting it all in PHP on that file itself but I don't know how.
MrPhil:
What you have now is
div.newsDiv
div.newsText
(blank) if settings table entry 'news_text' is empty, otherwise
BBCode-parsed 'news_text' entry
What do you mean by "I want to change what text and links are shown in it"? Are you looking to change it (the "News") the same for all themes, or just for specific theme(s)? As you noted, it's in the database, so there should be an interface in Admin for changing the news (it will affect all themes that display the news). If you're looking for different news for different themes, that would be tougher (but still possible). Please clarify.
Groovystar:
We use a custom news table and don't use the one in the admin panel, but I want to change this stuff by individual skin, not change it for all the skins. I already know how to go in and change what it says by going into phpmyadmin and just changing the text from there. For the skins I want to say something different that will not work because it would change all the skins.
MrPhil:
So you want different News content per theme (skin)? You would need two things:
* a separate database entry for that theme's news (as well as the interface to update news_text_theme1, news_text_theme2, etc.). So you would have $modSettings['news_text_skin1'], $modSettings['news_text_skin2'], etc. floating around. The toughest part would be generalizing the news_text code to handle an arbitrary number of themes (skins) rather than just one of fixed name.
* different code in a theme-specific file (Themes/<theme name>/index.template.php) that could hard-code the news name for each theme (perhaps just use the theme name itself, so it would be something like $modSettings['news_text_' . $themeName])
Anyway, that would be one way to approach it.
Groovystar:
Would it be at least relatively easy to just create a new news table per skin in the database? I could do it that way, if it is safe. I just don't know how as I've never made new tables in there before.
I was thinking also to just write each one' text out in the index.template.php since these are more information than news, and wouldn't have to be changed all that often.
Navigation
[0] Message Index
[#] Next page
Go to full version