inherit
20332
0
Jul 3, 2024 14:49:17 GMT -8
Vu1canF0rce
729
February 2004
daviper
|
Post by Vu1canF0rce on Mar 29, 2013 17:55:45 GMT -8
Ah, I misunderstood your use case for this variable. Yes, as it turns out, you cannot use normal template variables inside custom pages. This isn't so much a bug, but it's something we haven't implemented. But IMO, it's something we need... your situation is a perfect example. There's no reason I can think of that we can't allow all "global" template variables (which at the moment is just $[current_user]), so I'll put in a feature request. In the meantime, I believe a simple plugin can do what you need to do. It's not ideal, but you won't have to wait for the new feature: $(document).ready(function() { if (proboards.data('route').name == 'page' && proboards.data('route').params.page_id == 'CUSTOMPAGE') { $('#content').prepend($('<a href="/user/' + proboards.data('user').id + '/groups">Click for groups</a>')); } }); Just something I threw together. Replace CUSTOMPAGE with your real page's name, and modify the jQuery prepend to insert whatever you want, wherever you want. (Hopefully you're familiar with jQuery ) Keith Rozett, I appreciate your reply. I am not skilled with jQuery. I've only programmed/coded in T-SQL and HTML and a tiny bit of JavaScript. I'll see if I can figure out implementation of that script above else it's not a big deal if the entire variable database will be released in the upcoming, or a near-future release and to wait for it. (Which I hope does come thru as that would make custom pages top-notch editable). EDITEDWell, I successfully failed on that one. The issue may be two things: 1) Although I read thru the primer on the jQuery website, contextually, it doesn't make sense to me in relation to ProBoards [from not knowing the overarching coding and syntaxes]. 2) I think it's also the fact that there's not enough of a primer on building and/or managing a PBv5 plugin that I don't know what I'm doing (regardless of a programming background or not). However, in my failed attempt, I copied your code and tweaked the html markup as desired but again not knowing the context of jQuery's syntax makes it difficult to manipulate without breaking the script (which I did in tinkering with #content). I created a basic plugin with no images, user interface, or keys, but only a JS component of which I copied the above into by itself. This does yield exactly what I want.......just at the top of the page before the content in my container (hence the $('#content'). I guess). I don't know the syntax to make it fit inline with the content on my HTML tab of the custom page. If this can be reconciled that would be awesome.
|
|
inherit
167925
0
Jun 9, 2014 17:15:50 GMT -8
swissunite
156
June 2011
testb1
|
Post by swissunite on Mar 30, 2013 5:54:20 GMT -8
Hi there, that is GREAT! I got this to work in my threads list $[thread.board] Board -> Display Name (in thread list template) - You now have access to the entire board object, so you not only get board.id and board.display_name, you'll also get board.moderator and all the other good stuff.
the display name is really handy on the recent threads - however, I am trying to suppress that column on all pages BUT recent threads /threads/recent
Is there any variable that allows me to grab the url and how to look thru that url for "/threads/recent"? I want to use that in an if statement and only display the board name if the url contains "/threads/recent".
thank you so much!
|
|
Keith Rozett
Full Member
Not that kind of doctor.
Not even the other kind, technically.
Posts: 720
inherit
Not that kind of doctor.
186408
0
Jul 7, 2015 11:21:48 GMT -8
Keith Rozett
Not even the other kind, technically.
720
November 2012
krozett
|
Post by Keith Rozett on Apr 1, 2013 8:22:22 GMT -8
Ah, I misunderstood your use case for this variable. Yes, as it turns out, you cannot use normal template variables inside custom pages. This isn't so much a bug, but it's something we haven't implemented. But IMO, it's something we need... your situation is a perfect example. There's no reason I can think of that we can't allow all "global" template variables (which at the moment is just $[current_user]), so I'll put in a feature request. In the meantime, I believe a simple plugin can do what you need to do. It's not ideal, but you won't have to wait for the new feature: $(document).ready(function() { if (proboards.data('route').name == 'page' && proboards.data('route').params.page_id == 'CUSTOMPAGE') { $('#content').prepend($('<a href="/user/' + proboards.data('user').id + '/groups">Click for groups</a>')); } }); Just something I threw together. Replace CUSTOMPAGE with your real page's name, and modify the jQuery prepend to insert whatever you want, wherever you want. (Hopefully you're familiar with jQuery ) Keith Rozett, I appreciate your reply. I am not skilled with jQuery. I've only programmed/coded in T-SQL and HTML and a tiny bit of JavaScript. I'll see if I can figure out implementation of that script above else it's not a big deal if the entire variable database will be released in the upcoming, or a near-future release and to wait for it. (Which I hope does come thru as that would make custom pages top-notch editable). EDITEDWell, I successfully failed on that one. The issue may be two things: 1) Although I read thru the primer on the jQuery website, contextually, it doesn't make sense to me in relation to ProBoards [from not knowing the overarching coding and syntaxes]. 2) I think it's also the fact that there's not enough of a primer on building and/or managing a PBv5 plugin that I don't know what I'm doing (regardless of a programming background or not). However, in my failed attempt, I copied your code and tweaked the html markup as desired but again not knowing the context of jQuery's syntax makes it difficult to manipulate without breaking the script (which I did in tinkering with #content). I created a basic plugin with no images, user interface, or keys, but only a JS component of which I copied the above into by itself. This does yield exactly what I want.......just at the top of the page before the content in my container (hence the $('#content'). I guess). I don't know the syntax to make it fit inline with the content on my HTML tab of the custom page. If this can be reconciled that would be awesome. It may be easier then to wait until we implement putting $[current_user] in custom page templates. Although jQuery is an important skill to have if you want to develop any plugins, my workaround is really just a hack. Using template variables is the right way to go here, but I can't predict when they will be available. Anyway, W3Schools has a good introduction to jQuery, although you'll need to understand CSS selectors first. www.w3schools.com/jquery/jquery_intro.aspHope this helps!
|
|
Keith Rozett
Full Member
Not that kind of doctor.
Not even the other kind, technically.
Posts: 720
inherit
Not that kind of doctor.
186408
0
Jul 7, 2015 11:21:48 GMT -8
Keith Rozett
Not even the other kind, technically.
720
November 2012
krozett
|
Post by Keith Rozett on Apr 1, 2013 8:36:44 GMT -8
Hi there, that is GREAT! I got this to work in my threads list $[thread.board] Board -> Display Name (in thread list template) - You now have access to the entire board object, so you not only get board.id and board.display_name, you'll also get board.moderator and all the other good stuff. the display name is really handy on the recent threads - however, I am trying to suppress that column on all pages BUT recent threads /threads/recent Is there any variable that allows me to grab the url and how to look thru that url for "/threads/recent"? I want to use that in an if statement and only display the board name if the url contains "/threads/recent". thank you so much! Hi swissunite, this is a somewhat common request - hiding or showing content based on what the URL is. Please check out our Plugin Database board and see if someone has made a plugin to do that. But to answer your question, no, there isn't a template variable with the URL in it. Given the number of requests we have for that, I'm going to suggest to the higher-ups that we add it to our template variables.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Apr 1, 2013 10:26:22 GMT -8
would all this be easier if a plugin was just written to show the board name on the recent posts/threads list? because I think with some of the recent additions, I can do that now
|
|
Keith Rozett
Full Member
Not that kind of doctor.
Not even the other kind, technically.
Posts: 720
inherit
Not that kind of doctor.
186408
0
Jul 7, 2015 11:21:48 GMT -8
Keith Rozett
Not even the other kind, technically.
720
November 2012
krozett
|
Post by Keith Rozett on Apr 5, 2013 13:02:02 GMT -8
Okay, I've added a new variable called $[post.thread_views] that you can use anywhere you can use the post variable. There's a reason you can't access the $[thread] data directly in the Post List template, and it has to do with how we separate things in our system. But you can use that new variable now. There's been a slight change now. Like we did for the $[thread.board] variable, we decided it was best to allow everyone full access to a post's thread object, like so: $[post.thread] So instead of $[post.thread_views] you would use $[post.thread.views]. This affects your request, tunescool. Now, if you noticed back in my first post explaining the variables I added, I said that $[post.thread] would be a link object (with href, text, etc. properties) rather than just a text string. Well, it won't be able to be used like that, because that is now the full thread object. So what you want instead is $[post.thread.link]. This affects your request, Chris. Keep in mind that none of these variables have been pushed live yet, so it only affects you if you started coding your templates in anticipation of the changes. Apologies for any confusion.
|
|
Keith Rozett
Full Member
Not that kind of doctor.
Not even the other kind, technically.
Posts: 720
inherit
Not that kind of doctor.
186408
0
Jul 7, 2015 11:21:48 GMT -8
Keith Rozett
Not even the other kind, technically.
720
November 2012
krozett
|
Post by Keith Rozett on Apr 5, 2013 13:23:13 GMT -8
would all this be easier if a plugin was just written to show the board name on the recent posts/threads list? because I think with some of the recent additions, I can do that now Yes, a plugin would do that nicely. Alternatively, there is a way to do it without plugins, but it involves CSS and template trickery. The problem is that the Thread List template can't tell you're on the Recent Threads page, but the Board template can tell. We set '$[board.display_name]' to 'Recently Updated Threads' for that page, so you could set up the correct columns, as well as a CSS class if you detect that the user is visiting that page. For example: <div class="content cap-bottom{if $[board.display_name] == "Recently Updated Threads"} recent-threads{/if}"> Then in the Thread List template, add your extra column, and give it a class like 'board-name'. In your forum's CSS add: .board-name { display: none; } .recent-threads .board-name { display: block; } Or that last line may need to be 'display: table-cell;' instead. You'll have to experiment. Man, when I first thought up this idea, it seemed really simple, but the plugin idea is looking better and better now.
|
|
Keith Rozett
Full Member
Not that kind of doctor.
Not even the other kind, technically.
Posts: 720
inherit
Not that kind of doctor.
186408
0
Jul 7, 2015 11:21:48 GMT -8
Keith Rozett
Not even the other kind, technically.
720
November 2012
krozett
|
Post by Keith Rozett on Apr 10, 2013 10:23:42 GMT -8
Okay, we had a push and all the new variables should now be available!
|
|
inherit
tunesrcoolii@gmail.com
86185
0
Oct 3, 2013 8:48:20 GMT -8
tunescool
4,399
August 2006
tunescool
|
Post by tunescool on Apr 10, 2013 12:15:02 GMT -8
theres $[user.last_online], i tried $[user.last_online_short] but nothing
can we have a last online that displays only the Month, Date, and Year
Apr 1, 2013
and then
20 minutes ago
etc for within the last day, and
yesterday at 1:33pm
i use Last Online in my miniprofile and its one of my favorite features, while browsing thru threads i can easily see when members were last online but
Last Online - Jun 30, 2012 at 2:34pm
is so long my miniprofile is too wide to fit just that field in
theres also a short for user registered on and maybe admins mite want their profile date formats the same
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Apr 16, 2013 10:54:06 GMT -8
Just an update for those of you following template changes, in the next push we've added a new avatar size, quote, that's the same size as the avatars in, well, quotes. $[USER_VARIABLE_HERE.avatar_quote] will work as of the next push.
|
|
inherit
Jack of All Trades, Master of None
27090
0
May 30, 2013 20:36:34 GMT -8
Stinky666
8,818
July 2004
stinky666
|
Post by Stinky666 on Apr 16, 2013 11:01:22 GMT -8
Just an update for those of you following template changes, in the next push we've added a new avatar size, quote, that's the same size as the avatars in, well, quotes. $[USER_VARIABLE_HERE.avatar_quote] will work as of the next push. Sorry but dumb question. What does the first part refer to exactly? The bit I have highlighted in red. $[ USER_VARIABLE_HERE.avatar_quote] I mean, I put what there, for example, to do what... Sorry, I know it's possibly really stupid, but I am interested in what stuff is, but just dunno how everything works.
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Apr 16, 2013 11:35:06 GMT -8
I just meant that anywhere there's a template variable that represents a user, this can be used. So any of the following will work (and more):
$[current_user.avatar_quote] $[user.avatar_quote] $[thread.created_by.avatar_quote] $[shoutbox_post.created_by.avatar_quote]
This will insert into the template an image of that user's avatar at the same size as that used in quotes.
|
|
inherit
Jack of All Trades, Master of None
27090
0
May 30, 2013 20:36:34 GMT -8
Stinky666
8,818
July 2004
stinky666
|
Post by Stinky666 on Apr 16, 2013 11:39:30 GMT -8
I just meant that anywhere there's a template variable that represents a user, this can be used. So any of the following will work (and more): $[current_user.avatar_quote] $[user.avatar_quote] $[thread.created_by.avatar_quote] $[shoutbox_post.created_by.avatar_quote] This will insert into the template an image of that user's avatar at the same size as that used in quotes. Ohhhhh right ok. Thanks for clarifying. It's greatly appreciated. Strangely, I actually like learning this new stuff for Version 5. Strangely because I don't usually like change etc haha
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Apr 16, 2013 20:13:20 GMT -8
resistance is futile.
|
|
inherit
Jack of All Trades, Master of None
27090
0
May 30, 2013 20:36:34 GMT -8
Stinky666
8,818
July 2004
stinky666
|
Post by Stinky666 on Apr 20, 2013 12:54:45 GMT -8
Tim Camara, any chance of variables for friends (and followers/following, but friends mainly) in the Info Center, and possibly for other places (mini profile).
|
|