[MODx] 3. Working with chunks, TV, Category

Source: Internet
Author: User
Tags modx

1. ADD Chunk:

For example, replace the header by using the chunk.

Usage: [[$chunk _name]]

    • Cut all the header code from the Learn template
<!DOCTYPE HTML><!--Escape Velocity by HTML5-html5up.net | @n33co free for personal and commercial use under the CCA 3.0 lice NSE (Html5up.net/license) -<HTML>    <Head>        <title>[[++site_name]]-[[*pagetitle]]</title>        <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />        <Metaname= "description"content="" />        <Metaname= "keywords"content="" />        <!--[If LTE IE 8]><script src= "Css/ie/html5shiv.js" ></script><! [EndIf] -        <Scriptsrc= "Js/jquery.min.js"></Script>        <Scriptsrc= "Js/jquery.dropotron.min.js"></Script>        <Scriptsrc= "Js/skel.min.js"></Script>        <Scriptsrc= "Js/skel-layers.min.js"></Script>        <Scriptsrc= "Js/init.js"></Script>        <NoScript>            <Linkrel= "stylesheet"href= "Css/skel.css" />            <Linkrel= "stylesheet"href= "Css/style.css" />            <Linkrel= "stylesheet"href= "Css/style-desktop.css" />        </NoScript>        <!--[If LTE IE 8]><link rel= "stylesheet" href= "Css/ie/v8.css"/><! [EndIf] -    </Head>
    • Create a new chunk called ' Learn_header ' and parse the content in.
    • Inside The Learn Template, put [[$learn _header]] as a placeholder.

2. Create a ' Template Variable ':

Usage: [[*tv_name]]

    • Click to new template variable called ' Favortext '

    • Input type as ' RichText '

    • Template Access assign to ' learn Template '

    • Then save it
    • Go to the Resource tab, ' Learn ' Document, you'll see there are a new tab call Tempalte variable

    • You'll see a rich text inside template variable and can write some text into it

    • We wil replace the text on the Web page by this ' TV ', so first add template variable into the ' Learn template '
        <!--Intro -            <DivID= "Intro-wrapper"class= "wrapper Style1">                <Divclass= "title">The Introduction</Div>                < SectionID= "Intro"class= "Container">                    <Pclass= "Style1">[[*favortext]]</P>                    <Pclass= "Style2">
    • View the page to see the change

3.down to the Category:

You can notice this, in the template variable, it show Uncategorized:

You can decide the category which your want, here, we divid the page according to the different part of color.

Therefore, 1. Black, 2. Saimon, 3. White:

    • Create those three categories

    • Edit ' Favortext ', select Category as ' Saimon ', index as ' 2 '
    • Copy favortext as ' Titletag ', set index as ' 1 ', input type as ' Text '

    • Inside the ' Learn Template ', add ' titletag ' into it.
        <!--Intro -            <DivID= "Intro-wrapper"class= "wrapper Style1">                <Divclass= "title">[[*titletag]]</Div>                < SectionID= "Intro"class= "Container">                    <Pclass= "Style1">[[*favortext]]</P>                    <Pclass= "Style2">
    • In the ' Learn ' document, template variable, add value to the Titletag

    • See the result

[MODx] 3. Working with chunks, TV, Category

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.