Textpattern Forum

You are not logged in. Register | Login | Help

#11 2012-04-05 21:44:11

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 2,951

Re: Editing sections via the panel

BTW, for quickly exploring what your clients will see when you assign them a certain user level, I recommend a plugin by one of our core devs, Bloke/Stef Dawson: smd_faux_role.

That way you don’t need to create any of TXP’s user levels, log out, change name and pass, log back in, click your way back to where you once were, just to see you’ve forgotten to leave a certain backend page open for comparisons.

With faux_role installed you’ll get a dropdown menu on any of the admin pages (very desirable but needs a quick editing the plugin code) to rapidly change role while staying on that page you want to explore in any user role.


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

Offline

#12 2012-04-05 21:53:23

thiago
New Member
Registered: 2012-04-05
Posts: 8

Re: Editing sections via the panel

Got it!

In the default theme, there’s a “About” section already created, but there’s no content. So I went to Content > Write and changed the “section’ dropdown menu on the right from “articles” to “about”. Is that correct?

Offline

#13 2012-04-05 21:55:30

thiago
New Member
Registered: 2012-04-05
Posts: 8

Re: Editing sections via the panel

Ah… Now there’s an About inside About :S

Edit-

Thanks for the plugin tip ;)

Last edited by thiago (2012-04-05 21:55:57)

Offline

#14 2012-04-05 22:10:04

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 2,951

Re: Editing sections via the panel

thiago wrote:

Is that correct?

Absolutely. When you now try the section links on any of your sites frontend pages, the article will appear under www.yoursite/about/yourarticle (in case you chose any of the speaking, hierarchic URL structures on Admin > Preferences). And it also changed its place (section) in the hierarchic content menu, left hand side on frontend pages.

Thanks for the plugin tip ;)

Welcome. Hope this tip doesn’t distract you too much from TXP essentials. In case you didn’t find how to install plugins: paste their text into the textarea on Admin > Plugins, click install (2x) and activate by clicking the link “No” which then changes to “Yes”. Read the help files for each plugin you install, they’re accessible from the plugins page.


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

Offline

#15 2012-04-05 22:24:13

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 542
Website

Re: Editing sections via the panel

thiago wrote:

Let’s say the client wants to edit the “Contact” page’s content. The content, not the “page template”. Is there a way to do that?

For that there are articles (like posts in WP)
You will need to create 3 things:

  • A page (template-code) or use exist one.
  • A section (a link to that template-code [example.com/contact])
  • An article (the dynamic content/text that will appear)

Name all “Contact”.
Set the section page “Uses page:” setting to “Contact” which is the template code you created.
Assign the article to the “Contact” section.

In the page/template-code Presentation > Pages > Contact you will need to use the txp:article /> tag, or txp:article_custom /> tag,
In this case I personally will choose to use the article_custom tag,
which will point on the specific article you just created and will not let to present any other articles’ content beside of it.

Let’s say your article ID# is “5”,
then your page/template-code can look something like this:
(you can find the article id# in the Content > Articles tab)

<!DOCTYPE html>
<html>
<head>
</head>
<body>
	<h1>Contact</h1>
	<txp:article_custom id="5">
		<txp:body />
	</txp:article_custom>
</body>
</html>

This will present the body content of article #5,
which will use for you and your client to easily edit it’s content.

In case and you choose to use the regular article tag instead of article_custom then it will look like this:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
	<h1>Contact</h1>
	<txp:article limit="1">
		<txp:body />
	</txp:article_custom>
</body>
</html>

Which will end with the same result unless you or your client will publish another article and assign it to the “Contact” section.
You can add the “sort” attribute to show only the first published article that assign to the section.
<txp:article limit="1" sort="Posted asc">
and if your client will change the publish date of the second article to be before the first one, then this will not help, which is why I choose to use article_custom and point on a specific article id# as mentioned in the first example code.

Done, from there each time you or your client will need to edit the basic content/text of “Contact” page, all you will need to do is to visit the Articles tab Content > Articles and edit the article.

Important to mention that this is just a very simple example, if you wish you can go wild with txp-forms/custom-fields and more.

Last edited by THE BLUE DRAGON (2012-04-05 22:25:32)

Offline

#16 2012-04-05 23:13:42

thiago
New Member
Registered: 2012-04-05
Posts: 8

Re: Editing sections via the panel

Gil, Uli, thank you so much for taking your time to help!

I think I’m starting to get the hang of pages, sections and articles. Lol

Now when I put some text in “About” section, it created another “About”, which is under “About” section (site.com/about/about) – this is something I have to change in “default” template? Or is there a way to do that via the panel?

Thanks again guys.

Last edited by thiago (2012-04-05 23:14:22)

Offline

#17 2012-04-05 23:28:28

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 542
Website

Re: Editing sections via the panel

thiago wrote:

Now when I put some text in “About” section, it created another “About”, which is under “About” section (site.com/about/about) – this is something I have to change in “default” template? Or is there a way to do that via the panel?

The second “about” it’s the article title, like in WP it was the post title.
For example it can be example.com/about/my-cool-biography
so “about” it’s the section name, and “my-cool-biography” it’s the article title.

In your case when you got only one article assign to the section there is no need to view the article via it’s full url,
you can just view the section example.com/about

Offline

#18 2012-04-05 23:34:54

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 2,951

Re: Editing sections via the panel

The duplicate title display is caused by the way the default templates are coded. You can bend TXP, however, like pretzel dough once you get your head around it.

There’s min three ways to avoid the duplicate “About”, off the top of my head:

  1. Rename the article (whose title is the second “About”).
  2. Don’t link to the article, link to the section instead (You can test what I mean by clicking the section name in your nav). That way the article’s title is never displayed in the nav cause the article can’t be accessed (thus no resulting submenu entry).
  3. Edit the template: Presentation > Pages. Remove the following code from the sidebar-1 div:

<txp:article_custom  section='<txp:section />' wraptag="ul" break="li">
	<txp:if_article_id>&rsaquo;</txp:if_article_id>
	<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>

But be aware that with this deletion you’ll remove the submenus from the complete sidebar nav, for all pages.

Well, of course a fourth way: It’s probably smarter to put a conditional tag around the above:
<txp:if_section name="about"><txp:else /> above the code,
and below it the closing </txp:if_section>.
What this does: it simply doesn’t output anything in case the section visited is “About” (caused by having no content between the if_section condition and the txp:else tag), for all other sections it displays the article title sub menu.

And this time Gil was faster ;)


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

Offline

#19 2012-04-05 23:56:13

thiago
New Member
Registered: 2012-04-05
Posts: 8

Re: Editing sections via the panel

Can’t thank you enough guys! :)

Already got the difference between pages, sections & articles, lol. Now it’s time to have a little play around ;)

I’ll try to create a theme for a band’s website.. let’s see if I can do it! :)

Offline

#20 2012-04-06 00:14:14

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 2,951

Re: Editing sections via the panel

Another recommendation is the TXP tag reference pages where all tags, their attributes and possible values as well as default values are explained and code examples show how the tags are correctly applied and usefully combined.

Good luck with your website project!


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

Offline

Board footer

Powered by FluxBB