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

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.
Post Reply
180michael
Forum Members
Forum Members
Posts: 27
Joined: Fri Dec 26, 2008 9:29 pm

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

Post 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
Last edited by 180michael on Thu Mar 05, 2009 5:53 pm, edited 1 time in total.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 729
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

Re: Site images broke when using internal pretty urls

Post 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
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
180michael
Forum Members
Forum Members
Posts: 27
Joined: Fri Dec 26, 2008 9:29 pm

Re: Site images broke when using internal pretty urls

Post 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?
owr_bgld

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

Post 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
padster
New Member
New Member
Posts: 5
Joined: Fri Sep 24, 2010 8:36 am

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

Post by padster »

its the template as well or it is the template thats is been thrown out
Post Reply

Return to “CMSMS Core”