Changing the value of $root.
This is an open discussion with 3 replies, filed under Troubleshooting.
Search
You can manually override the value of $root
by changing line 4 of index.php
. Something like:
define('DOMAIN', 'somedomain.com');
@hoopy: I am not sure what’s your problem. But I wouldn’t advise to edit core files without any need. so it would be good to have a more comprehensive description of your problem.
Generally Symphony doesn’t save the root anywhere but determines the root “on-the-fly”. So moving a website should be painless (if you don’t break any links – in your pages’ XSL they should always be defined as relative links or by using the $root
parameter).
A way to affect the domain name value without editing core files
I’m working on a multi-domain system (aka ninja) for symphony. I needed to 1) allow for local development and 2) have the the domain name change depending on which site was being accessed. In my case if one goes to parkcitiestownhomes.com $root
shows up as lardnergroup.com, the parent company. So I created some Global Parameters in my master.xsl file that I hope might help you (see below). I use $parent-website-url
where you might normally use $root
.
<!-- master-domain is used to filter out non-ninja friendly results and replace them with the satellite domain --> <xsl:param name="master-domain" select="'lardnergroup.com'" /> <xsl:param name="top-level-domain"> <xsl:choose> <xsl:when test="contains($root,'.com')"> <xsl:text>.com</xsl:text> </xsl:when> <xsl:when test="contains($root,'.org')"> <xsl:text>.org</xsl:text> </xsl:when> <xsl:when test="contains($root,'.net')"> <xsl:text>.net</xsl:text> </xsl:when> <xsl:when test="contains($root,'.local')"> <xsl:text>.local</xsl:text> </xsl:when> <xsl:when test="contains($root,'.info')"> <xsl:text>.info</xsl:text> </xsl:when> <xsl:when test="contains($root,'.us')"> <xsl:text>.us</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>NULL</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:param> <xsl:param name="parent-website-url"> <xsl:value-of select="/data/website-structure/entry/domain-name[../sort=1]"/><xsl:value-of select="$top-level-domain"/> </xsl:param> <xsl:param name="satellite-site-domain"> <xsl:choose> <xsl:when test="contains($root,'http://www')"> <xsl:value-of select="substring-before(substring-after($root,'://www.'), $top-level-domain)" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring-before(substring-after($root,'://'), $top-level-domain)" /> </xsl:otherwise> </xsl:choose> </xsl:param> <xsl:param name="satellite-site-name"> <xsl:value-of select="data/website-structure/entry/title[../domain-name/@handle = $satellite-site-domain]" /> </xsl:param>
Hope this helps.
Create an account or sign in to comment.
I had a site that was on a shared server and had a url like this during development: http://174.24.56.42/~foo/. Now that we’ve got the site live it’s url is http://somedomain.com/ and the value of $root is http://somedomain.com/~foo/. This works just fine w/ or w/o the “~foo/” part… it would just be nice if it wasn’t there. How would I go about changing this?