Hi all…I have purchased the MSM module, have it installed and working okay across my three sites (they pull in the templates, etc correctly).
I am however having trouble with the “weblog:entries” tag, and the {path=} variable.
Here is what is happening…
I am on viewing templates from SiteA at http://siteA.mydomain.com/ - this works fine, and pulls in weblog entries from the SiteA weblogs no worries.
When I put this code into a SiteA template:
{exp:weblog:entries weblog="static" site="SiteB"}
- {title}
- {path=test/something}
{/exp:weblog:entries}
What I get back is:
- SiteB Test Title
- http://siteA.mydomain.com/test/something/
I have set the CP > Admin > System Preferences > General Configuration URL’s correctly, but when using the “site=” parameter, it does NOT set the “path=” variable correctly.
Any ideas?
Thanks in advance.
Mod Edit: Moved to the Technical Support forum.
I am afraid that is expected behavior, the {path} variable always takes the current site into account. I think a feature request to support specifying the site (much as we have with {embed}) would be an excellent idea. Until then, perhaps you could use some other variables of the weblog module? {comment_url_title_auto_path} or {permalink} might be a good choice.
Thanks Ingmar. I figured that that might be the answer… it’s a shame, as I really like the path variable! Oh well, not to worry!
Do you know if there is any way to get another sites URL with any variable (outside the weblog:entries tag)…something like…
{site_url site="SiteB"}
Thanks for your help…it is much appreciated.
Thanks Sue. You are right of course very right about the variables (although I am not sure what Fresh Variables are…will have to look that up!!). My only concern (and it is because I am a finicky bugger) is that I then have to update the URLs in even more places!
What I am doing at the moment is building a little plugin to do this for me. You would call it by doing something like:
{exp:site_url site="SiteB"}
I will post it once I have it working.
😊
As promised, here is a REALLY basic plugin that you can use to grab the site_url from any of the sites listed in the exp_sites table.
Just bung the file into the system/plugin directory and you are away.
The tag MUST have the ‘site’ parameter. It can have either the site’s short_name, or the site_id. Some examples:
{exp:site_url site="default_site"}
OR
{exp:site_url site="1"}
It will return…well the site_url for that site! If it can’t find the site, then it return blank.
Sorry to keep bugging you…but I have extended the plugin. I have also renamed it badly (so hopefully it doesn’t conflict with anything else!!).
To get the site_url of a particular site…
{exp:sites:site_url site="default_site"}
OR
{exp:sites:site_url site="1"}
To add in a path to the site_url of a particular site…
{exp:sites:path site="default_site" path="template_group/template"}
OR
{exp:sites:path site="1" path="template_group/template"}
Any suggestions for improvement are welcomed.
Sorry for the late reply but this could be exactly what I’m looking for!
I am pulling in assets from the ‘master site’ and I want to use the path from the that site and not the others (I am running International sites with /de/ at the end etc.
I’ll let you know how it pans out 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.