We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

MSM path plugin

Development and Programming

Andrew Gunstone's avatar
Andrew Gunstone
101 posts
16 years ago
Andrew Gunstone's avatar Andrew Gunstone

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.

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

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.

       
Andrew Gunstone's avatar
Andrew Gunstone
101 posts
16 years ago
Andrew Gunstone's avatar Andrew Gunstone

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.

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

agun, you could of course create a global variable for that site or use Fresh Variables to have the variable work on all your MSM sites.

Does that make sense?

       
Andrew Gunstone's avatar
Andrew Gunstone
101 posts
16 years ago
Andrew Gunstone's avatar Andrew Gunstone

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.

😊

       
Andrew Gunstone's avatar
Andrew Gunstone
101 posts
16 years ago
Andrew Gunstone's avatar Andrew Gunstone

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.

       
Andrew Gunstone's avatar
Andrew Gunstone
101 posts
16 years ago
Andrew Gunstone's avatar Andrew Gunstone

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.

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

Nifty idea. Since it got into a custom plugin, I’m going to shift to the ‘plugin’ forum where folks are more likely to look for it. I’ll tweak the title a bit as well.

Thanks for sharing it with the community!

       
Andrew Gunstone's avatar
Andrew Gunstone
101 posts
16 years ago
Andrew Gunstone's avatar Andrew Gunstone

Thanks Robin for moving this to a more appropriate forum. I am always glad to pitch in and help when I can! The super active community is one of the top 3 things that sold me on EE.

Cheers.

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

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 😊

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

Works fantastic!

Can this plugin be adapted to create a list of all sites (names and site_url) to create for example -

SiteA Name - http://siteA.domain.com SiteB Name - http://siteB.domain.com SiteC Name - http://siteC.domain.com

       
Andrew Gunstone's avatar
Andrew Gunstone
101 posts
16 years ago
Andrew Gunstone's avatar Andrew Gunstone

Hi stinhambo. Yes, it probably can. I am a bit under the gun at the moment with work, but will keep this in mind if I get a second over the next few days.

Good idea for the plugin!!

😊

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

w00t!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.