Urlsuffix Conflicts Anchor Name

When I make ‘<a name=“test”></a>’ tag in the page xxx, and try to jump to this tag using ‘http://hostname/xxx#test’, but as I used urlsuffix configuration thus the url is changed to ‘http://hostname/xxx#test.html’ instead of ‘http://hostname/xxx.html#test’. Does anybody out there can solve this issue?

How are you generating the URL?

Following is a part of my main/config.php




   	// application components

    	'components'=>array(

     		:

            	'urlManager'=>array(

                    	'urlFormat'=>'path',

                    	'showScriptName'=>false,

                    	'urlSuffix'=>'.html',

                    	'rules'=>array(

                            	'rss'=>'feed',

                            	'/'=>'site/index',

                    	),

            	),

        	:



Does anyone have an idea for solving this issue?

Hi mocapapa,

Yii treats the anchor as a $param parameter when it creates an url.

Try this:




echo CHtml::link("Go to Test", array("controller/action", "#"=>"test"));



http://www.yiiframework.com/doc/api/1.1/CUrlManager#createUrl-detail

http://www.yiiframework.com/doc/api/1.1/CHtml#normalizeUrl-detail

Hi Softark,

Itsumo Osewani Nattemasu! (‘I am always taken care of.’ by yahoo translation :slight_smile:

This works fine! Thank you.