Question for new page creation [Solved]

Discussion about MagicEdit features, modules, applications, and HowTos.

Question for new page creation [Solved]

Postby guiding » Tue Jun 11, 2013 12:46 pm

Hi. My client would like to create new pages. While the guides at http://www.magicedit.com/PartIIICreateNewPage.cl and http://www.magicedit.com/MagicRepeatTags.cl helped I have encountered challenges. I am able to create new pages, but content changed on one page changes the same content on other pages. Also link recursion happens with page IDs (http://www.guidingfitness.com/menulink/280/289)

Here's the link code.
Code: Select all
<magicrepeat me_repeat="yes" me_name="menulink">
      <li><a magicedit href="/menulink.shtml">Menu Link</a></li>
<magicrepeat>


Here's the abbreviated menulink.shtml template.
Code: Select all
<magicrepeat me_repeat="yes" me_name="menulink_main_content_smallblock">
   <div class="textarea">
      <div class="bottom">
         <div class="middle">
            <div class="contentwrapper">
               <magicedit me_name="content_area_1">
                  <h1>Small Block Title</h1>
                  <p>Paragraph one</p>
               </magicedit>
            </div>
            <div style="clear: both;"></div><!-- fixes display bugs in IE -->
         </div>
      </div>
   </div>
</magicrepeat>

<magicrepeat me_repeat="yes" me_name="menulink_main_content_block">
   <div class="textarea">
      <div class="bottom">
         <div class="middle">
            <div class="contentwrapper">
               <magicedit me_name="content_area_2">
                  <h1>Block Title</h1>
                  <h3>Heading title or paragraph</h3>
                  <p>Paragraph one</p>
               </magicedit>
            </div>
            <div style="clear: both;"></div><!-- fixes display bugs in IE -->
         </div>
      </div>
   </div>
</magicrepeat>


How do I create new pages with unique IDs while preserving content uniqueness from one page to another? Also how do I remove url recursion? Thank you.
Last edited by guiding on Wed Jun 12, 2013 5:53 pm, edited 2 times in total.
guiding
 
Posts: 17
Joined: Tue Jan 15, 2013 1:45 pm

Re: Question for new page creation

Postby raw10 » Tue Jun 11, 2013 4:50 pm

There are a couple of fundamental things that should help you here. By default, MagicRepeat should maintain content uniqueness across new pages, at least if you use it out of the box. But there are a couple of caveats here.

  • All <magicedit> regions, including text, links, and images will be unique within a given instance of a MagicRepeat scope.
  • MagicRepeat by default does not nest. If you want to nest MagicRepeat instances, you should set the me_repeat flag to "yes".
  • Relative links from within a given MagicRepeat region automatically link to a unique instance of a page.

Let's see how this will apply to your example.

First, let's suppose you want to create a top level menu that will be available on all pages. Here's what it might look like:

Code: Select all
<magicrepeat me_name="menulink">
  <li><a href="/menulink.shtml"><magicedit me_name=title" me_plain>Menu Link</magicedit></a></li>
<magicrepeat>


Note that I'm not setting me_repeat="yes" here, nor am I setting the link to be editable by giving it the magicedit attribute. (Aside: Editable links are designed for file downloads and external links, not for use with MagicRepeat in general. MagicRepeat will automatically update each instance of the link, so there's no need to do anything further to a relative site link inside a MagicRepeat.)

Now on my menulink.shtml page I can add various content blocks. The simplest is just to put MagicEdit elements on the page:

Code: Select all
<div class="textarea">
  <div class="bottom">
    <div class="middle">
      <div class="contentwrapper">
        <h1><magicedit me_name=title" me_plain>Menu Link</magicedit></h1>
        <magicedit me_name="content_area_1">
          <p>Paragraph one</p>
        </magicedit>
      </div>
      <div style="clear: both;"></div><!-- fixes display bugs in IE -->
    </div>
  </div>
</div>
<div class="textarea">
  <div class="bottom">
    <div class="middle">
      <div class="contentwrapper">
        <magicedit me_name="content_area_2">
          <h1>Block Title</h1>
          <h3>Heading title or paragraph</h3>
          <p>Paragraph one</p>
        </magicedit>
      </div>
      <div style="clear: both;"></div><!-- fixes display bugs in IE -->
    </div>
  </div>
</div>


There is absolutely no need to put any additional MagicRepeats on this page, not unless you want to repeat each of those sections multiple times on the page.

Try that out and see what it does for you. Note also the <magicedit me_name="title" me_plain> link that exists in the menulink magicrepeat AND in the menulink.shtml page. Each instance of the repeat will have that title on both the linked list and the repeated page, and it will be unique to each instance of the repeat. You will be able to edit it from either place and they will stay synchronized. This is how you edit text inside a MagicRepeat, NOT by using editable links.

As for URL recursion, as you call it, each MagicRepeat page must have a unique identifier so the system can serve up the appropriate content. You will typically see a URL that looks something like /menulink/280 for the top level repeat. If you have nested repeat pages (e.g. a page inside a category), you will necessarily have a default URL that looks like /menulink/280/289. To change that URL to something else, just click on the "Edit URL" link in the upper right when logged in and on the repeat page. You can then change that URL to be whatever you want (so long as it's unique in the site).

Once you get the hang of a single top-level repeat, then we can start talking about how to nest them using me_repeat="yes". Try the above, and if you want to start nesting repeats we can help with that too.

tl;dr: Don't overuse the MagicRepeat tag, and don't put magicedit on URLs unless you want to do external links or file downloads. And by default MagicRepeat does most of the work for you to make content unique.
raw10
 
Posts: 81
Joined: Tue Apr 12, 2011 2:46 pm

Re: Question for new page creation

Postby guiding » Wed Jun 12, 2013 5:49 pm

Thank you very much for your assistance!

I tried many of your suggestions without much success. My co-worker has more knowledge with MagicEdit than me and was able to assist. For posterity reasons here's the solution we came up with:

Menu:
Code: Select all
<magicrepeat>
   <li><a href="menulink.shtml"><magicedit me_name="title" me_plain>Menu Link</magicedit></a></li>
</magicrepeat>


Menulink.shtml template
Code: Select all
<magicrepeat me_repeat="yes" me_name="menulink_main_content_smallblock">
   <div class="textarea">
      <div class="bottom">
         <div class="middle">
            <div class="contentwrapper">
               <magicedit>
                  <h1>Small Block Title</h1>
                  <p>Paragraph one</p>
               </magicedit>
            </div>
            <div style="clear: both;"></div><!-- fixes display bugs in IE -->
         </div>
      </div>
   </div>
</magicrepeat>

<magicrepeat me_repeat="yes" me_name="menulink_main_content_block">
   <div class="textarea">
      <div class="bottom">
         <div class="middle">
            <div class="contentwrapper">
               <magicedit>
                  <h1>Block Title</h1>
                  <h3>Heading title or paragraph</h3>
                  <p>Paragraph one</p>
               </magicedit>
               <p>
               <table width="90%" border="0" cellpadding="0" cellspacing="0">
                     <tr>
                        <td>
                        <ul style="margin: 0; padding: 0 0 0 20px;">
                           <magicrepeat me_repeat="yes" me_name="menulink_main_content_block_table_1">
                                 <li><magicedit me_name="listing_info_1">List item</magicedit></li>
                           </magicrepeat>
                        </ul>
                        </td>
                        <td>
                        <ul style="margin: 0; padding: 0 0 0 20px;">
                           <magicrepeat me_repeat="yes" me_name="menulink_main_content_block_table_2">
                              <li><magicedit me_name="listing_info_2">List item</magicedit></li>
                           </magicrepeat>
                        </ul>
                        </td>
                     </tr>
               </table>
               </p>
               
               <magicedit>
                  <h3>Heading 2 title or paragraph</h3>
                  <p>Paragraph one</p>
               </magicedit>
                  <p>
                     <table class="classtimes_legend" border="0" cellspacing="0" cellpadding="0" style="font-size: 0.7em !important;">
                        <thead>
                           <tr>
                              <th><magicedit me_name="legend_info_1">Table heading content goes here</magicedit></th>
                              <th class="division">&nbsp;</th>
                              <th><magicedit me_name="legend_info_2">Table heading content goes here</magicedit></th>
                           </tr>
                        </thead>
                     </table>
                  </p>

                  <p>
                     <magicedit>
                     <h3>Heading 3 title or paragraph</h3>
                     <p>Paragraph one</p>
                     </magicedit>
                     <ul>
                        <magicrepeat me_repeat="yes" me_name="menulink_main_content_block_list">
                           <li><magicedit me_name="listing_info_3">List item<magicedit></li>
                        </magicrepeat>
                     </ul>
                  </p>
            </div>
            <div style="clear: both;"></div><!-- fixes display bugs in IE -->
         </div>
      </div>
   </div>
</magicrepeat>


This above code works for our client's needs.
guiding
 
Posts: 17
Joined: Tue Jan 15, 2013 1:45 pm


Return to MagicEdit Discusson

Who is online

Users browsing this forum: No registered users and 1 guest

cron