Type of Site:
3 posters
Page 1 of 1
Type of Site:
I want a select script code to show above the "Title of the topic" when members open a new topic they choose what type of sites they have just for one section Request Center. -> http://forumdirectory.forumotion.net/f16-request-center
Is your site a website, blog, or forum? with 3 option
Website
Blog
Forum
Is your site a website, blog, or forum? with 3 option
Website
Blog
Forum
Re: Type of Site:
Hi @Mati,
Just to clarify ; You want a selection drop down before the topic title input field, and when you select an option it'll add it to the beginning of the topic title, correct ?
Just to clarify ; You want a selection drop down before the topic title input field, and when you select an option it'll add it to the beginning of the topic title, correct ?
Re: Type of Site:
Try the following.
Go to Modules > JavaScript codes management > Create a new script
Placement : In all the pages
At the top you can change the label, and option names : values.
If any questions let me know.
Go to Modules > JavaScript codes management > Create a new script
Placement : In all the pages
- Code:
$(function() {
var config = {
name : '<strong>Select your website type :</strong> ',
option : {
'Is your site a website, blog, or forum?' : 'DEFAULT',
'Website' : 'Website',
'Blog' : 'Blog',
'Forum' : 'Forum'
}
},
bloc, select, i;
if (document.post && document.post.f && document.post.f.value == 16) {
select = document.createElement('SELECT');
bloc = document.createElement('DL');
for (i in config.option) select.innerHTML += '<option value="' + config.option[i] + '">' + i + '</option>';
select.onchange = function() {
var sujet = document.post.subject;
if (this.value == 'DEFAULT') sujet.value = sujet.value.replace(/^\[.*?\]\s/, '');
else {
if (/^\[.*?\]\s/.test(sujet.value)) sujet.value = sujet.value.replace(/^\[.*?\]\s/, '');
sujet.value = '[' + this.value + '] ' + sujet.value;
}
};
bloc.innerHTML = '<dt><label>' + config.name + '</label></dt><dd></dd>';
bloc.getElementsByTagName('DD')[0].appendChild(select);
document.post.subject.parentNode.parentNode.parentNode.insertBefore(bloc, document.post.subject.parentNode.parentNode);
}
});
At the top you can change the label, and option names : values.
If any questions let me know.
Re: Type of Site:
Works perfect how I wanna it xD but is it possible to add classes for each of them
So I can style it with CSS.
- Code:
<div class="text_forum">Forum</div>
<div class="text_blog">Blog</div>
<div class="text_web">Website</div>
So I can style it with CSS.
Re: Type of Site:
Replace the script with this :
I changed the value into an array :
['VALUE', 'CLASSNAME']
class name is optional of course.
- Code:
$(function() {
var config = {
name : '<strong>Select your website type :</strong> ',
option : {
'Is your site a website, blog, or forum?' : ['DEFAULT', 'text_default'],
'Website' : ['Website', 'text_web'],
'Blog' : ['Blog', 'text_blog'],
'Forum' : ['Forum', 'text_forum']
}
},
bloc, select, i;
if (document.post && document.post.f && document.post.f.value == 16) {
select = document.createElement('SELECT');
bloc = document.createElement('DL');
for (i in config.option) select.innerHTML += '<option value="' + config.option[i][0] + '" '+ (config.option[i][1] ? 'class="' + config.option[i][1] + '"' : '') +'>' + i + '</option>';
select.onchange = function() {
var sujet = document.post.subject;
if (this.value == 'DEFAULT') sujet.value = sujet.value.replace(/^\[.*?\]\s/, '');
else {
if (/^\[.*?\]\s/.test(sujet.value)) sujet.value = sujet.value.replace(/^\[.*?\]\s/, '');
sujet.value = '[' + this.value + '] ' + sujet.value;
}
};
bloc.innerHTML = '<dt><label>' + config.name + '</label></dt><dd></dd>';
bloc.getElementsByTagName('DD')[0].appendChild(select);
document.post.subject.parentNode.parentNode.parentNode.insertBefore(bloc, document.post.subject.parentNode.parentNode);
}
});
I changed the value into an array :
['VALUE', 'CLASSNAME']
class name is optional of course.
Re: Type of Site:
Ain't working I have made a topic as you can see http://forumdirectory.forumotion.net/f16-request-center there is no class?
Re: Type of Site:
Oh, you mean style the texts in the title ? You'd need to set a JavaScript in the sub-forums. Use this :
At the top is an object which contains the tag name + the class you want applied to it. Then you just need to use CSS to style the texts.
- Code:
$(function() {
var keywords = {
'[Forum]' : 'tag-forum',
'[Blog]' : 'tag-blog',
'[Website]' : 'tag-website'
},
title = $('a.topictitle'), i = 0, j = title.length, k, str, reg;
for (; i < j; i++) {
str = title[i].innerHTML;
for (k in keywords) {
reg = new RegExp('^' + k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), 'i');
if (reg.test(str)) {
title[i].innerHTML = str.replace(reg, '<span class="' + keywords[k] + '">' + k.replace(/\[|\]/g, '') + '</span>');
break;
}
}
}
});
At the top is an object which contains the tag name + the class you want applied to it. Then you just need to use CSS to style the texts.
Re: Type of Site:
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
Team Leader
Review Section Rules | Request A Review | Sticker Points
Similar topics
» WHICH TYPE OF FORUM SITE IS BEST FOR THIS....THANK YOU
» Why do I have to type www. to have the site redirect to my domain name without forumotion in it?
» Domain Problem, i dont know what to Type in at the Domain Site.
» HEY Ppl!! im New Join my site and i will Public YOUR Site in my site . But be a member or a <MOD> thx
» ADDS~ showing up on site ~ To visitors on opening the site and also when viewing contents posts
» Why do I have to type www. to have the site redirect to my domain name without forumotion in it?
» Domain Problem, i dont know what to Type in at the Domain Site.
» HEY Ppl!! im New Join my site and i will Public YOUR Site in my site . But be a member or a <MOD> thx
» ADDS~ showing up on site ~ To visitors on opening the site and also when viewing contents posts
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum