Wednesday 26 October 2005 12:28:13 pm
Alexandre, thanks, but you misunderstood the question. You are correct that making a virtualhost install is well documented, but that isn't what I want (actually, wanted, I gave up and used a virtualhost install in the end.) The challenge is to create this:
example.com/en/page (siteaccess 'en') example.com/fr/page (siteaccess 'fr') The problem is that ezroot() strips the siteaccess name 'en'. Marko came up with an interesting solution, which is similar to the solution I eventually developed, and probably slightly easier. My solution was to use a define: {def $btaccesstypename=$access_type.name scope="global"}
within pagelayout.tpl to give access to the siteaccess name within sub templates, and then put the following within the sub-template, for example:
<a href="/{$#btaccesstypename}{$node.url_alias|ezroot("no")}">blah blah</a>
Within the template, thereby reconstructing the url from the site access. This worked, and I was very close to using this on the final site. However, we have a central ez install on our server, and may want to have more ez-based sites using that same code base, for that reason I decided to use virtual host, with HostMatchType=map, for the simple reason that I didn't want to just have siteaccess names 'en' and 'es' but rather 'banterminator-en' and 'banterminator-es' etc, to enable for other 'en' and 'es' sites in future. Otherwise, I would have used the idea above. Either way, even with ezroot() you still have to strip out all of the ezurl() references from every template, which is a nuisance - something as core as the url structure generated by ezurl() should be customisable somewhere. Also, here is the script I used to do mass search and replace of ezurl with ezroot across templates. copy into a file, make executable:
#!/bin/sh
if [ $# -lt 3 ] ; then
echo -e "Wrong number of parameters."
echo -e "Usage:"
echo -e " renall 'filepat' findstring replacestring\n"
exit 1
fi
#echo $1 $2 $3
for i in `find . -name "$1" -exec grep -l "$2" {} \;`
do
mv "$i" "$i.sedsave"
sed "s/$2/$3/g" "$i.sedsave" > "$i"
echo $i
#rm "$i.sedsave"
done
At some point I will write up a full how to of my experiences getting a multilingual site working in ez, with more details of the above configuration that I didn't use in the end, since it's a good way to do it if you have a dedicated ez code base for your site.
http://carroll.org.uk
|