{content item=page}? [solved]

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
uniqu3

Re: {content item=page}?

Post by uniqu3 »

Maybe you should read some hot to use and how to do help files  :)

Did you edit your htaccess file so your mod_rewrite also can work? Example htaccess.txt can be found on /doc folder of CMSMS, simply change it to .htaccess and upload to you CMSMS root folder, if it's in a subfolder you will have to change RewriteBase setting in .htaccess.
NaN

Re: {content item=page}?

Post by NaN »

I don't understand the problem.
You need to call the menu two times.

First to get the menu entries.
Use smarty {capture} to assign the output to a var. (to avoid processing the menu for each content again):

Code: Select all


{capture assign="menu"}{menu ... }{/capture}

Second to get the content output.
There you place for each content the menu we just captured:

Code: Select all


{foreach from=$nodelist item=node}
   <div id="{$node->alias}" class="scrollto_container">
      <a name="{$node->alias}"></a>
      <div class="menu">{$menu}</div>
      <div class="content">
         {eval var=$cgsimple->get_page_content($node->alias)}
      </div>
   </div>
{/foreach}

This will give you the content of all pages wrapped in a div with id="[pagealias]" and an anchor link named with the page content alias (to be able to use your site without js).

All you need to do now is to create a menu template that just links to that anchors:

Code: Select all


{foreach from=$nodelist item=node}

...

<a href="#{$node->alias}" class="scrollto">{$node->menutext}</a>

...

{/foreach}

If the anchorlinks still cause a reloading of the page you can prepend the root_url to the menulink:

Code: Select all


<a href="{root_url}#{$node->alias}" class="scrollto">{$node->menutext}</a>


Additionally you need a js that tells jQuery what to do if links of class "scrollto" are clicked but returns false:

Code: Select all



//



I don't understand what this has to do with mod_rewrite.
Last edited by NaN on Fri Oct 08, 2010 10:27 am, edited 1 time in total.
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am

Re: {content item=page}?

Post by Ruben_c »

Thanks for the answers, I get the content in separates div and create the respective menu fixed in the header pointing to the divs. My probem is  how deactivate or disable the links.

An explantion.

if you create the following link in a simple html file

page don`t do nothing. right? don't go anywhere.

but if a create this same link in a content page of CMSMS or in menu, IT send me to the home page, I don't wanna go to the homepage!!

I explain well? I want create dead links, but I can't... and don`t know why. Maybe this is a feature of the CMSMS?.
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am

Re: {content item=page}? [solved]

Post by Ruben_c »

Well, with default template the problem was solved. I trying a test site with 5 page anyone with a diferent template, the last one using the scroll. Just when a turn it to a default, all works fine!!.
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: {content item=page}? [solved]

Post by spcherub »

I don't believe the problem is solved - it is just masked because your links now point to the page this is the new page. So the page is reloading but it does not look different because it is loading the page that you are already on.

You will run into issue if you use this menu on other pages - your links will lead back to the (no new) default page.

Just saying!
Sanjay
Ruben_c
Forum Members
Forum Members
Posts: 35
Joined: Thu Jun 17, 2010 3:12 am

Re: {content item=page}? [solved]

Post by Ruben_c »

Yes, you're right, but at least work  ;D,  and don't know how to kill the links to avoid the redirection.
A simple template that you can do with CMS Made simple.

http://www.octoporos.cl
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: {content item=page}? [solved]

Post by spcherub »

If you give us access to a dev site perhaps we can help you fiz the problem instead of just masking it. Normally using onclick="return false;" disables the default behavior of the tag. You said it did not work for you, but it hard to know what else is interfering with that.

Try this piece of code in a simple html page (or anywhere in your template):

Code: Select all

<a href="http://yahoo.com" onclick="return false;">Disabled link</a>
You will see the link but it is inactive (or at least it should be). If not, there's something else going on and only being able to look into your specific setup will we be able to help out more.

Sanjay
NaN

Re: {content item=page}? [solved]

Post by NaN »

@Ruben_c: Are there any other javascripts that has influence of the link behaviour?
Last edited by NaN on Sun Oct 10, 2010 6:19 pm, edited 1 time in total.
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: {content item=page}? [solved]

Post by spcherub »

Yes with some frameworks like jQuery you can override default behavior. For instance one can do the following:

Code: Select all

$(document).ready(function() {
    $('a').click(function(e) {
        e.preventDefault();
    });
});
This will prevent the default behavior of ALL links on the page. So not knowing what else may have this kind of effect on the original poster's problematic page makes it harder to figure out what else is going no.

NaN - as I finish typing this I realize that you may not have been asking the question of me, but of the original poster. I'll leave my comment here anyway, so he can get an idea of other potential problem sources.

S
NaN

Re: {content item=page}? [solved]

Post by NaN »

spcherub wrote:
NaN - as I finish typing this I realize that you may not have been asking the question of me, but of the original poster.
Right ;)
Marked it with an "@Ruben_c".

Just wanted to know if there is some javascript that returns true or anything else but false if this link is clicked. So that an onclick="return false;" maybe would have no effect.

Another question @Ruben:
Is the base tag used in your template?
How does it look like? If there is any difference between your base url and the currently loaded url in address bar the browser might load the base url apending the # (cause he thinks it is anchor on another page).
Post Reply

Return to “CMSMS Core”