Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
how to insert text into .php
Avatar
Star Buck
Rookie
Free Members
sp_UserOfflineSmall Offline
Dec 23, 2011 - 8:42 am

Hello,

 

since this is my first post, just let me say how great v5 is so far! 🙂
While trying out features, I had some idea to insert some fixed text somewhere in spTopicView.php (or anywhere else for that matter), so how do you add some text codewise in the php-file to show up in forum?

Also, if I want to insert a variable text like topicheader to for example make the permanent link also with text, how do you do that?

 

Example:

sp_PostIndexPermalink('tagClass=spButton spLeft', 'VARIABLE TEXT HERE', __sp('The post permalink'));

Goal is that the button shows the icon for permalink and right next to it as part of the icon the topicheader as clickable text. Any help appreciated, thanks!

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 23, 2011 - 10:41 am

not sure what you are asking or what you want to do...  what do you mean by VARIABLE TEXT HERE?

that whole line is just php, so you can do whatever you want in php...  as you have it now, the text string VARIABLE TEXT HERE would be output... 

are you saying you want to change it up depending on something??  you could do:

$string = ....  # whatever you want to determine the string value

sp_PostIndexPermalink('tagClass=spButton spLeft', $string, __sp('The post permalink'));

if you mean a different string based on circumstances... but you have to code up the determination of the string...

also, keep in mind that its a POST permalink, not a topic permalink, and needs to be within the post loop...

sorry if I am not following and have missed your question... please explain further if needed...

Avatar
Star Buck
Rookie
Free Members
sp_UserOfflineSmall Offline
Dec 23, 2011 - 2:53 pm

Sorry for not being clear, but that trick with the variable just did it!

Thanks Mr Papa and also thanks for the whole v5 again, just amazing software being for free!!!

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 23, 2011 - 3:25 pm

okay cool! themes are just php, so you can do whatever php allows... we just provide some template tags and api for common items

Avatar
Star Buck
Rookie
Free Members
sp_UserOfflineSmall Offline
Dec 23, 2011 - 5:06 pm

Can you just tell me how to get the topicHeader from this function

sp_TopicHeaderName('tagClass=spHeaderName spLeft');

into a $stringVariable so I can print it elsewhere again?

 

$stringVariableHeader = sp_TopicHeaderName('tagClass=spHeaderName spLeft');

just prints out the Topic on screen, but does not seem to store the topic as text.

 

Also, is there a common function for printing out text or $strings formatted with classes like 'tagClass=spPostUserDate spRight' ?

 

Thanks again for helping me understand sp.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 23, 2011 - 5:21 pm

still not sure what you want... do you just want the topic name??  use variable $spThisTopic->topic_name

again, this is php... so if you just want to write out some text, do:

echo 'my string';

if you want the string to be html and have classes or ids, then:

echo '<p class="some-class">my text</p>';

would write a paragraph containing 'my text' with a class of some-class...

for php reference:  http://php.net

Avatar
Star Buck
Rookie
Free Members
sp_UserOfflineSmall Offline
Dec 23, 2011 - 5:54 pm

Thanks again Mr Papa!

So is there a list of all common variables for sp like $spThisTopic?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 23, 2011 - 5:59 pm

well since 5.0 is still in beta, we havent updated all our online docs yet... will soon...

these are the general ones that we make available to themes:

global $spGroupView, $spThisGroup, $spForumView, $spThisForum, $spThisSubForum, $spThisForumSubs,
$spTopicView, $spThisTopic, $spThisPost, $spThisPostUser, $spListView, $spThisListTopic,
$spThisUser, $spProfileUser, $spMembersList, $spThisMemberGroup, $spThisMember,
$sfglobals, $sfvars;

but keep in mind, they are only valid in certain places... $spThisTopic for example would not be set on the group view page... and some, like $spThisPost, is only valid when within the post loop...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625