Page 1 of 1

[solved] Re: Site images broke when using internal pretty urls

Posted: Mon Feb 09, 2009 3:57 am
by 180michael
Hello all!

I'm having a similar problem but with anchors.
  • Pretty urls are enabled and needed for SEO
  • Links to anchors on the same page return the browser to the base URL + anchor (e.g., http://www.example.com/#myAnchor)
  • Anchors work with {metadata showbase="false"} but images now do not work
Is there a way to have anchors and images working with pretty urls? Thanks for your help.

180michael

cmsms 1.5.2, php 5.2.5, apache 2.0

Re: Site images broke when using internal pretty urls

Posted: Sun Feb 15, 2009 8:30 am
by JohnnyB
I'm having trouble posting -  sorry if this is a duplicate!!!!

Try using the anchor or cms_selflink tag - see Extensions, Tags.

Keep in mind that if you just use it will reference the root of the CMSMS install. So you have to reference the page you are on.  You can hard code the page so it is like

you might be able to use {$page_id}:: but if the page is a child of a parent page, the parent page will not be given.  It will not generate "parent-page/child-page/#your-anchor"

Another approach, is to modify the User Defined Tag I posted for rel="canonical" links to get the current page, (http://forum.cmsmadesimple.org/index.ph ... #msg146490)

name this UDT something something like CurrentPage:

Code: Select all

global $gCms;
if ($gCms->variables['page_name'] !='') {
	$manager =& $gCms->GetHierarchyManager();
	$node =& $manager->sureGetNodeByAlias($gCms->variables['page_id']);
	
	$content =& $node->GetContent();
	if (isset($content) && is_object($content))
	{
		if ($content->GetURL() != '')
		{
		echo $content->GetURL();
		}
	}
}
Then call it as part of your anchor
and the HTML generated will be http://www.your-domain.com/your-page-alias/#your-anchor

Re: Site images broke when using internal pretty urls

Posted: Tue Feb 24, 2009 6:32 pm
by 180michael
This worked fine for me. Thank you!

I do wish it was a little easier for clients though who don't know or want to use smarty tags. How easy would it be to parse links for sites that are using pretty urls?

Re: [solved] Re: Site images broke when using internal pretty urls

Posted: Mon Mar 15, 2010 10:58 am
by owr_bgld
If you won't make an UDT you can use the var $page_alias

But good to know the UDT if  in an case the page_alias doesn't work

Re: [solved] Re: Site images broke when using internal pretty urls

Posted: Fri Sep 24, 2010 8:56 am
by padster
its the template as well or it is the template thats is been thrown out