Standardized Templates

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
Jhuff
Posts: 10
Joined: Thu Oct 02, 2014 5:05 pm

Standardized Templates

Post by Jhuff »

Hey Everyone,

I'm wondering if it's possible to have a standard template for all FAQ. For instance when you create a new FAQ, it already has populated, some text that we would fill in.

Is that possible?

Thanks!
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Standardized Templates

Post by Thorsten »

Hi,

yes, that's possible with TinyMCE templates, check http://www.tinymce.com/wiki.php/Plugin:template

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Jhuff
Posts: 10
Joined: Thu Oct 02, 2014 5:05 pm

Re: Standardized Templates

Post by Jhuff »

Hey Thorsten,

I've followed the guide, and I'm pretty sure I'm doing something wrong :)

Do you, or does anyone else, have any examples that's working for them?

Thanks,
Josh
Jhuff
Posts: 10
Joined: Thu Oct 02, 2014 5:05 pm

Re: Standardized Templates

Post by Jhuff »

Hey Sorry for the double post, but I got it working. For anyone else that would like it, here's what I did.

Firstly find the footer.php file located in phpmyfaq/admin

Find the line:
theme_advanced_buttons3

And add template on the end. It should look like this:

Code: Select all

theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,advhr,|,ltr,rtl,|,fullscreen,template",
Now scroll down a bit till you find the Template_replace_Values section, and comment it out.

Code: Select all

//    template_replace_values : {
//        username : "<?php print $user->userdata->get('display_name'); ?>",
//        user_id  : "<?php print $user->userdata->get('user_id'); ?>"
//    }
And below it, we're going to add our template:

Code: Select all

template_templates : [
	{
		title : "KB Template",
		src : "../assets/js/kbtemp.html",
		description : "Adds the default fields for a KB Article"
	},
	
]
The title and the location can be changed, but that's were I'm using it. Now if you're going to use the same location find the folder PHPmyfaq/assets/js. Create the HTML file you listed in the src field. In my case its kbtemp.html.

In this file we're going to have a DIV class which holds all the data, and within that, you'll have just normal html code. For instance mine looks like this:

Code: Select all

<div class="mceTmpl">
<h3>1. Description </h3><br>
<h3>2. Cause</h3><br>
<h3>3. Warnings</h3><br>
<h3>4. Instructions</h3><br>
<h3>5. This Article Applies to:</h3><br>
<h3>Additional Information if Available</h3><br>
</div>
Save it, and start a new KB Article. You should now have the button for Templates, and you should see your template listed in the drop down.

Thanks!
Thorsten
Posts: 15559
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Standardized Templates

Post by Thorsten »

Hi,

cool!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply