Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Topic Icons and Post Icons
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 12, 2012 - 9:25 pm

all of the template tags defaults are defined in the appropriate php file where the code for that template tag is...  so you will need to look at the code to see the defaults...

this will change over time as we get our codex better populated...  we will have a codex page for each template tag including the defaults... just not there yet...

as a two man coding team and one guy helping out here and with themes and the codex, its going to take some time...

volunteers welcome!! cool

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 12, 2012 - 9:27 pm

oh... and should add that not every template tag has the truncate...  just titles...   the breadcrumbs were not considered a title...  so group name, forum name, topic name got the treatment...

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Jan 12, 2012 - 9:54 pm

OK Steve so why does my second truncate example not work in that case, it is for a topic title I believe, fine on the breadcrumbs though although to be fair if you do not have nested breadcrumbs you could end up with problems. Imagine languages with long words?

So that's what I am asking - where is the spRowIcon tag defined, which php file? I can't find it and I have tried, honest! If I understand you correctly the tags are not separated into individual php files yet but it is your intention to do so eventually. At the moment the tags are in various php files, probably where they were first utilised?

Can you tell me why the code does not work, or give me an example of how to pass the argument iconUnread=xxx.png?Is it because I need to find where the tag spRowIcon is defined and pass the argument(s) there?

Do I need to pass the argument for both icons like this with respect to syntax?

('tagClass=spRowIcon spLeft&icon=sp_TopicIcon.png&iconUnread=sp_TopicIcon_new_post.png');

or need I only pass the argument for iconUnread? Perhaps then in the absence of an unread post the default icon will be used?

I think a few more examples and I'll get it.

Sorry to be a pain.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jan 13, 2012 - 3:50 am

The real problem is not having the documentation in place yet of course.

It's a shame that this thread has gone to a new page but I wil refer back best I can.

You said that truncate on sp_TopicIndexName did not work. I can not explain why as your syntax looks fine and it most assuredly does work on my site.

While using truncate in sp_BreadCrumbs will not currently work anyway you did actually use a $ instead of an & to separate the arguments which would have been incorrect. As it happens NOT adding support for this to the breadcrumbs was just an oversight on my part and I will add in support for that today.

Your use of iconUnread in sp_TopicIndexIcon again looks to be fine although my eyesight is not what it once was! Again this works perfectly for me on my test sites so if not for you I am unable to explain. I am assuming that the forum you tried it on did in fact have topics with unread posts!

Finally - you did reference the function sp_SubForumIndexIcon which again should be OK to use except again I missed this one and will correct that today. Sorry - put it down to the bout of flu I am still trying to shake off. embarassed

Right - today's lesson!

Every template function is defined with a set of default arguments. If no arguments are passed to the function when it is called, the defaults are automatically used. So - to take up your example - it is not necessary to pass the icon name 'sp_TopicIcon.png' - which is the default - unless you want to replace it with an icon of a different name. As it stands, I have defined the default 'iconUnread' to be the same as 'icon' (we may change that but have not decided yet). So, if you do want an unread icon to be used it IS necessary to pass this as an argument.

If you look at all the files in the 'templates' folder of a theme and concentrating on the base forum templates only, they are split into Group, Forum and Topic Views plus Head and Foot templates.

if you now look in the SP folder simple-press/forum/content you will find the template function code files. Group, Forum and Topic views are obvious. The Head and Fot function are in the 'common-view' file because these are used on all pages.

So - for an example - with no documentation in place, if you need to look at the default arguments for the template function sp_TopicIndexIcon - this appears in the spForumView template and the function itself is in the sp-forum-view-functions.php file. And where that function is defined you will find immediately the list if available arguments and their default values - all of which can be overridden when called by a template.

So endeth today's lesson. Explore away!

andy-signature.png
YELLOW
SWORDFISH
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Jan 13, 2012 - 4:03 am

Oh I assuredly will! I'll let you know how I get on.

Thanks very much for that Andy it is most informative.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jan 13, 2012 - 4:18 am

I just wish I had been writing it in the codex we need to build rather than in forum posts!

andy-signature.png
YELLOW
SWORDFISH
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Jan 13, 2012 - 4:28 am

Copy paste?

The iconUnread function is now working a treat, thanks!

Now back to the truncate problem.

Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Jan 13, 2012 - 4:58 am

Yup done

sp_TopicIndexName('tagClass=spRowName&truncate=100', __sp('Browse the thread %NAME%'));

Works fine, let me know when the breadcrumbs support is checked in.

Conrad

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jan 13, 2012 - 5:18 am

It's in svn now.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Conrad_Farlow
Sheffield, UK
Member
Free Members
sp_UserOfflineSmall Offline
Jan 13, 2012 - 7:03 am

Tis all done and working fine.

Test site

Now to figure out why the main container is not quite centred correctly, this is the WP theme css and not simple press I think.

Conrad

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
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: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626