MSM path plugin
Posted: 26 August 2008 09:41 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  155
Joined  03-17-2008

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}<br />
{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.

 Signature 

WebFreelancers - Permanent and Freelance Web Design/Development Jobs - Built on EE
(Previously known as ‘agun’)

Profile
 
 
Posted: 27 August 2008 04:58 AM   [ Ignore ]   [ # 1 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33338
Joined  05-15-2004

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.

Profile
MSG
 
 
Posted: 27 August 2008 05:32 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  155
Joined  03-17-2008

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.

 Signature 

WebFreelancers - Permanent and Freelance Web Design/Development Jobs - Built on EE
(Previously known as ‘agun’)

Profile
 
 
Posted: 27 August 2008 07:32 AM   [ Ignore ]   [ # 3 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  30388
Joined  04-29-2002

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?

Profile
MSG
 
 
Posted: 27 August 2008 07:37 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  155
Joined  03-17-2008

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.

grin

 Signature 

WebFreelancers - Permanent and Freelance Web Design/Development Jobs - Built on EE
(Previously known as ‘agun’)

Profile
 
 
Posted: 27 August 2008 07:58 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  155
Joined  03-17-2008

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.

File Attachments
pi.site_url.zip  (File Size: 2KB - Downloads: 260)
 Signature 

WebFreelancers - Permanent and Freelance Web Design/Development Jobs - Built on EE
(Previously known as ‘agun’)

Profile
 
 
Posted: 27 August 2008 08:24 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  155
Joined  03-17-2008

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.

File Attachments
pi.sites.zip  (File Size: 2KB - Downloads: 282)
 Signature 

WebFreelancers - Permanent and Freelance Web Design/Development Jobs - Built on EE
(Previously known as ‘agun’)

Profile
 
 
Posted: 27 August 2008 09:13 AM   [ Ignore ]   [ # 7 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16186
Joined  05-20-2002

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!

 Signature 
Profile
 
 
Posted: 27 August 2008 04:24 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  155
Joined  03-17-2008

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.

 Signature 

WebFreelancers - Permanent and Freelance Web Design/Development Jobs - Built on EE
(Previously known as ‘agun’)

Profile
 
 
Posted: 15 January 2009 11:02 PM   [ Ignore ]   [ # 9 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1642
Joined  01-05-2007

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 smile

 Signature 

Steven Hambleton | Hambo Development

WE SPECIALISE IN WORKING WITH AGENCIES AND BUILDING LONG TERM DEVELOPMENT PARTNERSHIPS 
Profile
 
 
Posted: 20 May 2009 04:50 AM   [ Ignore ]   [ # 10 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1642
Joined  01-05-2007

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

 Signature 

Steven Hambleton | Hambo Development

WE SPECIALISE IN WORKING WITH AGENCIES AND BUILDING LONG TERM DEVELOPMENT PARTNERSHIPS 
Profile
 
 
Posted: 21 May 2009 12:11 AM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  155
Joined  03-17-2008

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!!

grin

 Signature 

WebFreelancers - Permanent and Freelance Web Design/Development Jobs - Built on EE
(Previously known as ‘agun’)

Profile
 
 
Posted: 21 May 2009 12:47 AM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1642
Joined  01-05-2007

w00t!

 Signature 

Steven Hambleton | Hambo Development

WE SPECIALISE IN WORKING WITH AGENCIES AND BUILDING LONG TERM DEVELOPMENT PARTNERSHIPS 
Profile