Printable Version of Topic
Click here to view this topic in its original format
Jcink.com Forums > General Support > template defaults [SOLVED]


Posted by: vanjie Jun 11 2018, 01:02 AM
hi! i'm in the process of switching an old skin over from CFS to html templates, and i was wondering if there's a way to convert the following part of the CFS script, or an alternative method that might achieve the same results:

CODE

customIndex.initialize({
config: {
       dateDefault: 'mmm dd, 0:00 AM',
       titleDefault: 'here',
       authorDefault: 'here',
}


more specifically, i'm looking to customize what displays in place of the topic title, author, and date if a forum is empty, rather than having blank fields/dashes.

thanks!

Posted by: mrslucky Jun 11 2018, 04:27 AM
that can be done by using javascript. let me verify first, do you want to have a default value for the "-- in: -- by" section? one more question, are you using the default template or are you making a custom one?

Posted by: vanjie Jun 11 2018, 11:04 AM
hi! bless, that’s exactly what i’m trying to achieve. to answer your second question, i’m making a custom one.

thanks so much!

Posted by: mrslucky Jun 11 2018, 10:45 PM
alright, since you're now making a custom template for forum row section, I've guessed that you have the variable <!-- |last_poster| -->, <!-- |last_topic| -->, and <!-- |last_post| --> on your template. all of this variable is the variables necessary to modify the blank fields/dashes.

<!-- |last_poster| --> stands for the "By:" section, <!-- |last_topic| --> stands for the "In: --" section, and the <!-- |last_post| --> stands for the "----" one.

now, replace your <!-- |last_poster| --> variable in your forum row template with
CODE
<script>if("<!-- |last_poster| -->" == ' ') { document.write("default author here"); } else { document.write("<!-- |last_poster| -->"); }</script>


replace your <!-- |last_topic| --> variable with
CODE
<script>if("<!-- |last_topic| -->" == '--') { document.write("default topic here"); } else { document.write("<!-- |last_topic| -->"); }</script>


and at last, replace your <!-- |last_post| --> variable with
CODE
<script>if("<!-- |last_post| -->" == '----') { document.write("default date here"); } else { document.write("<!-- |last_post| -->"); }</script>


that should do it, but I don't know if there are any syntax errors or something so if it doesn't work let me know http://files.b1.jcink.com/html/emoticons/smile.gif

Posted by: vanjie Jun 12 2018, 01:20 AM
amazing, this seems to be working perfectly! thank you so much!

Posted by: John Jun 13 2018, 07:33 AM
This topic has been solved. If you need anymore help please post a new thread. Thanks for choosing Jcink services.

'
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)