Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2006-07-22 02:46:20

Shaliza
Member
Registered: 2006-01-22
Posts: 59

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Great plugin!

Offline

#14 2006-07-23 11:24:55

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Inspired wrote:

Exactly! Basically you just need that second domain to share the database … then you give different content to those domains/subdomains with a little help of the “if” statement. That’s the idea.

Got it. Cool.

I’ve been thinking about a new personal project so if it ever sees the light of day I’ll look into this plugin more closely and try and write up a case study.

Offline

#15 2006-07-29 05:03:23

Vitruvius
Plugin Author
Registered: 2004-09-21
Posts: 125

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

I’ve finally gotten this plugin to work in my server environment.

It didn’t seem to work on my server, so after a little googling, I changed <code>SERVER_NAME</code> to <code>HTTP_HOST</code>

I have a client who wants to manage one website that handles both his Australian and his NZ business arms. So there are two addresses:

website.com.au
website.co.nz

I also wanted to be able to cope with a preceding ‘www.’, so I changed to code to allow for that.

The resulting plugin code is:

<code>
function ied_if_domain($atts, $thing) { extract(lAtts(array(‘domain’ => false), $atts)); return parse(EvalElse($thing,eregi(str_replace(‘.’,’\.’,$domain),$_SERVER[‘HTTP_HOST’])));
}

</code>

I’m not sure why <code>HTTP_HOST</code> works on my server – perhaps because of the way the server is shared??

I could see the possibility to add the second hack as an optional parameter – eg ‘check start of domain or not’

Regards

SH

Offline

#16 2006-07-31 00:42:30

Inspired
Plugin Author
From: Kiev, Ukraine
Registered: 2005-01-28
Posts: 87
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Vitruvius, thank you for sharing your version, it may help someone, and I will look into the option of updating the plugin if it appears necessary.


Plugin Composer — admin plugin to write your own plugins

Offline

#17 2006-08-02 14:00:01

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Yura,
I had missed this one. You’re doing some good work man.

:)

Matthew


Offline

#18 2006-08-16 18:32:26

brian.zollinhofer
Member
From: Virginia
Registered: 2006-07-10
Posts: 24
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Alright Yura, I think I’m getting this a bit, but still don’t have it working the way I want it to. Just a little help should get me to the right place.

I have http://zollinhofer.com working correctly. I also have http://zollinhofer.com/math displaying the way I want it to (the math page is it’s own separate page template in TXP. I want to be able to go to http://math.zollinhofer.com and for it to show http://zollinhofer.com/math. How do I go about doing that?

I guess I don’t know how to have a conditional statement show an entire page.

<code><txp:ied_if_domain domain=“math.zollinhofer.com”>
show the entire math page here
<txp:else />
show the entire nomal http://zollinhofer.com/index.php here
</txp:ied_if_domain></code>

I don’t know how to do that correctly with txp code.

Any help is appreciated.<br /><br />-Brian<br />——————-<br /><a href=“http://zollinhofer.com”>Zollinhofer.com</a>


Zollinhofer.com

“It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt.”
- Mark Twain

Offline

#19 2006-08-16 19:17:50

Inspired
Plugin Author
From: Kiev, Ukraine
Registered: 2005-01-28
Posts: 87
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Good task, Brian.
To answer the question you should first answer another one – How do you put contents of a section to the front page? I guess with the help of txp:article_custom. Then you design your front page design with the help of the conditional, which will populate the contents of your section on math.zollinhofer.com, or txp:else whatever you choose to be on your main domain.

Since a page template is the maximum level where you can put a conditional (or any other tag at all), you can’t put into condition page template itself. You will have to copy the contents of your math section’s page template into the conditional so that one template or the other shows up depending on what domain is called. (a possible solution could also be a query to the database to insert the content of the other page template, not having copy it – it’s a space where the plugin can be improved – to include the tag that would do that.)

Good luck, and have fun!


Plugin Composer — admin plugin to write your own plugins

Offline

#20 2006-08-16 20:34:47

brian.zollinhofer
Member
From: Virginia
Registered: 2006-07-10
Posts: 24
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Beautiful! It works just as I thought it should. Thanks for your bits of help. The txp:article_custom is a very helpful piece of this puzzle for me. Thanks!

You can see it at work at http://zollinhofer.com and http://math.zollinhofer.com.
<br /><br />-Brian<br />——————-<br /><a href=“http://zollinhofer.com”>Zollinhofer.com</a>


Zollinhofer.com

“It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt.”
- Mark Twain

Offline

#21 2006-08-29 19:28:48

Walker
Plugin Author
From: Boston, MA
Registered: 2004-02-24
Posts: 592
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Does anyone know how to hack (or a plugin to fix) the permalinks that are output so they apply to a specific sub domain?

Example of what’s happening right now: looking at article at http://ia.mydomain.com &rarr; Click on permlink’d title &rarr; Get shunted over to http://mydomain.com/ia/article-title

Example of what I’d like to happen: looking at article at http://ia.mydomain.com &rarr; Click on permlink’d title &rarr; Get taken to full article view at http://ia.mydomain.com/article-title

I spent an hour or so trawling the textpattern source and only managed to figure out how to do it on the deprecated version. I’m not sure how they’re doing it in 4.0.3.

Offline

#22 2006-08-29 20:38:26

Inspired
Plugin Author
From: Kiev, Ukraine
Registered: 2005-01-28
Posts: 87
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Invent your own permlink.
Use
<txp:php>echo $GLOBALS['thisarticle']['section'];</txp:php>
<txp:php>echo $GLOBALS['thisarticle']['permlink'];</txp:php>
or whatever you may need. Use reference @focusontheclouds or @rise.lewander.com


Plugin Composer — admin plugin to write your own plugins

Offline

#23 2006-08-29 21:24:18

Walker
Plugin Author
From: Boston, MA
Registered: 2004-02-24
Posts: 592
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

ah, excellent.
thanks.

Offline

#24 2006-09-09 18:17:55

brian.zollinhofer
Member
From: Virginia
Registered: 2006-07-10
Posts: 24
Website

Re: [plugin] [ORPHAN] ied_if_domain - manage multiple domains with only one TXP

Okay, I got this bad boy to work (thanks so much, it’s great)!

I did apply a favicon to the head, but it only shows up on http://www.zollinhofer.com, not http://math.zollinhofer.com. Am I doing something wrong, or do I need to change anything? I did not put it in an ied_if_domain statement…


Zollinhofer.com

“It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt.”
- Mark Twain

Offline

Board footer

Powered by FluxBB