Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-08-14 14:12:58

mmelon
Member
Registered: 2006-03-02
Posts: 95

preselect the section when visiting the write page

Hi,

I understand how you can use bot write customise and glz custom fields to create a kind of custom content type. Say a blog article that has a specific write page layout and only relevant fields. I also get how you can make a custom splash or help page using smd tabber that can offer specific functions such as ‘write a new blog article’.

My question is, how would I add a link to the write page and preselect the section, so that the ‘write a blog article’ link preselects the blog section and only shows the required fields via bot wc?

Thanks,
Mike

Offline

#2 2011-08-14 14:56:09

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 586
Website

Re: preselect the section when visiting the write page

Install the rah_ plugin that makes you click on a section name before you can go to the write screen. Right-click one of those links, copy the URL and you’re set.

Offline

#3 2011-08-14 15:10:21

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,271

Re: preselect the section when visiting the write page

Yep. maruchan was faster. In my version, however, the rah screen before opening the write tab doesn’t appear for each new article, and the link dynamically adapts to the section it belongs to.

As I understand it you’d like putting a link on a tab created by smd_tabber? I haven’t used smd_tabber yet, but you probably can bend to your needs a method I’ve found for an “Add article to this section”-link for the front end side:

Install rah_write_each_section and edit it by replacing its complete content with the following stripped down version of it:

    ##################
    #
    #    rah_write_each_section-plugin for Textpattern
    #    version 0.1
    #    by Jukka Svahn
    #    http://rahforum.biz
    #
    ###################

    if (@txpinterface == 'admin') register_callback('rah_write_each_section','article');

	function rah_write_each_section() {
		$section = gps('s');
		if(!gps('ID') && !ps('ID') && gps('s') && !ps('Section')) {
			echo 
				'<script language="javascript" type="text/javascript">'.n.
				'	$(document).ready(function() {'.n.
				'		$("#section option[value='.str_replace('"','\"',$section).']").attr("selected","selected");'.n.
				'	});'.n.
				'</script>';
		}
	}

Your link will look something like this:

<a href="<txp:site_url />textpattern/index.php?event=article&amp;s=<txp:section />">New article in this section</a>

Last edited by uli (2011-08-14 17:59:34)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#4 2011-08-14 15:14:59

mmelon
Member
Registered: 2006-03-02
Posts: 95

Re: preselect the section when visiting the write page

brilliant. Thanks very much for the quick solutions.

best,
Mike

Offline

Board footer

Powered by FluxBB