Support Forum
I'm customizing the Unified theme and would like to move the 'start new topic' button to the top of the forum.
I'm putting this:
sp_PostNewTopicButton('tagId=spPostNewTopicButtonTop&tagClass=spButton spRight', __sp('Start New Topic'), __sp('Start a new topic'), __sp('This forum is locked'));
in the spHead.php file where I want it to appear.... but the button doesn't show.
I'm thinking maybe it's not defined at this point yet? Or am I barking up the wrong tree?
***
News For Shoppers is seeking consumer reporters,
consumer advocates, and entertainment writers:
visit: NewsForShoppers.com/write/
I will have to double-check this but I suspect that the data the button function requires is not yet available. The other issue, of course, is that the spHead displays in all views and all forums. If the user is currently looking at, say, the group view page or their profile - which forum would be the target for a new topic?
I will ponder on this however...
YELLOW
SWORDFISH
|
Opps, had missed that a user can't choose the forum on the add topic form. Oh well, I may put this idea on the shelf for now 🙂
***
News For Shoppers is seeking consumer reporters,
consumer advocates, and entertainment writers:
visit: NewsForShoppers.com/write/
I did try copying the
# == Start New Topic FORM - OBJECT DEFINITION ========================
section to the top of spHead.php to see if that was something that was required for the button to work, but it didn't seem to make a difference.
***
News For Shoppers is seeking consumer reporters,
consumer advocates, and entertainment writers:
visit: NewsForShoppers.com/write/
spHead is shown on all pages... and the needed data wont be there... not sure where @yellow-swordfish was going, but will wait for his answer in AM...
Visit Cruise Talk Central and Mr Papa's World
I don't understand why..... but this:
if (sp_this_topic()){
sp_PostNewTopicButton('tagId=spPostNewTopicButtonTop&tagClass=spButton spRight topNewbutton', __sp('Start New Topic'), __sp('Start a new topic'), __sp('This forum is locked'));
}
elseif (sp_this_forum()){
sp_TopicNewButton('tagClass=spButton spRight topNewbutton', __sp('Start New Topic'), __sp('Start a new topic'), __sp('This forum is locked'), __sp('No permission to start topics'));
}
seems to work in spHead.php to put the button where I want it.
If I don't put it in an if statement, I don't get any result. If I do, it works. That seems very odd to me.
In simple testing, the form works fine like this. I have not done extensive testing yet.
Chris
***
News For Shoppers is seeking consumer reporters,
consumer advocates, and entertainment writers:
visit: NewsForShoppers.com/write/
a bit surprising... we dont normally call class functions like that since it be creating a potentially large object when doing so and its not needed... this will create a topic view object and possibly a forum class object on every page load... not insignificant resource usage...
have you checked your php error log? wondering if any notices for doing this since not sure all the needed data would exist on non forum and topic view pages... notices are mostly harmless but do fill up the error log if generated on every page...
if it works (it just might) and doesnt generate a lot of errors and you dont mind the page loading slow down for creating those large objects, it might hold true...
Visit Cruise Talk Central and Mr Papa's World
oh, and you have to put in an if statement (so to speak) because those functions return a boolean... just calling them would "work" but not doing anything for you.. they are designed to be the main loop of their respective page views... and if true, start the page loop for displaying items...
that is, they are designed to be using in if statement or looping constructs...
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)