Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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
Registered: 2006-08-15
Posts: 4,303

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: 619
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: 619
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
Registered: 2006-08-15
Posts: 4,303

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
Registered: 2006-08-15
Posts: 4,303

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

#21 2012-04-09 07:55:01

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

Re: Editing sections via the panel

Hey guys…

Is it possible to create custom theme options? Something like this in WP http://goo.gl/6AkLA

Offline

#22 2012-04-09 08:27:16

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Editing sections via the panel

[ This should ideally be a separate thread topic ]

There’s no panel like there is in WP (AFAIK they’re all theme-specific anyway) but there are a number of different options you can explore:

Site-wide variables or text snippets

  • adi_variables, which stores a list of variables that you load at the beginning of your page template. You can then insert them in your page template where you need them with txp:variable or test for them with txp:if_variable. Variables are strictly text-only.
  • mck_snippets, which is a proprietary solution for storing chunks of text (formatted or not).

Per article options:

  • Custom fields. If you want a special kind of custom field, such as a check-box you might want to invest in glz_custom_fields.
  • Override forms as a means of displaying individual articles with a different layout or markup (example of its use).
  • Conditional tags in your page template that respond differently depending on what you fill out, e.g. <txp:if_excerpt><txp:excerpt /><txp:else /><txp:body /></txp:if_excerpt>. Use the same principle to test if a custom field is set.

Per author options:

  • smd_bio allows you to make additional fields per author (good for multi-author sites).

Last edited by jakob (2012-04-09 08:27:30)


TXP Builders – finely-crafted code, design and txp

Offline

#23 2012-04-10 10:56:51

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

Re: Editing sections via the panel

A great plugin to customize the look of the write tab is bot_write_tab_customize
And another cool Stef’s plugin smd_tabber can be helpful.

But basically you can do it all using an article,
by creating a section and name it “Options”, then assign a new article to it with all the content
if for example it’s for changing the logo or header images, you can use the article-image field, if you want more images-fields and a better way to deal with them then use bot_image_upload plugin.
after that use article_custom to output that options-article content wherever you just want to in your pages/forms-codes.

If you are looking for a fast easy way without dealing with the Write-tab at all, then use smd_tabber to create a new tab, name it “Options”
in that tab page-code just drop links to where you want, so it will use like a fast easy navigation to edit stuff like specific – articles/images/files/links, and that’s all.

Offline

Board footer

Powered by FluxBB