Jump to content
Sign in to follow this  
Chewett

Managing Content Sections

Recommended Posts

Copied From Murs initial Post (no code changed)

[b]Managing Content Sections[/b]
In the content sections you put all text, stories, forms, templates, javascript and all things that are not MDScript code. Instead of putting all content in one big piece, you can separate it by placing a content separator, thats exactly this string: <!-- content separator -->
All the pieces of content separated by such a separator, will be available for use in the MDScript under the @content array starting at index zero.

Example:

[php]Content part 1
<!-- content separator -->
Some other content
<!-- content separator -->
A template [[test]] with variables
<!-- content separator -->
A form <form ...> ... </form>[/php]


This will be in the MDScript seen as:

[php]@content[0] = Content part 1;
@content[1] = Some other content;
@content[2] = A template ... with variables;
@content[3] = A form <form ...> ... </form>;[/php]


This way of separating content is very useful. You could display different content sections depending on different rules you set in the script. Also its very important when you use templates. Edited by Chewett

Share this post


Link to post
Share on other sites
Isn't this a mistake? I think that

Content part 1
<!-- content separator -->
Some other content
<!-- content separator -->
A template [[test]] with variables
<!-- content separator -->
A form <form ...> ... </form>


Would generate:

@content[0] = Content part 1;
@content[1] = Some other content; <-------------------This line got skipped.
@content[2] = A template ... with variables;
@content[3] = A form <form ...> ... </form>; Edited by Chewett

Share this post


Link to post
Share on other sites

By the way, it's
[b]<!-- content separator -->[/b]

Not
[b]<!-- content section -->[/b]


That caused me some minor headaches earlier. :D

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Forum Statistics

    15,832
    Total Topics
    173,490
    Total Posts
  • Recently Browsing

    No registered users viewing this page.

  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...