Giorgi625 VIP
Total posts: 655
14 Sep 2017 12:10

Hello guys, I am working on a site with more then 10 sections and via Mightysites I plan to split this site to 2 sites.

But I have one problem which I will explain using example below to explain it more clearly:

Site 1 - movie.com has sections: movies, tv-shows, actors, director.

Site 2 - music.com has sections: labels, groups, singers.

If you don't know what Mightysites does, I will explain it shortly: it allows to creat multiple sites on one joomla installation and one database. So truly I will have two same sites but on one site I will display sections for movie.com and on another sections for music.com but other hidden sections will exist on both sites.

there are also some other sections but here we don't need to mention them.

So for example we have singer "PSY", who has appeared in TV-show called "Weekly IDol"

for example full view of record "PSY" has this url : music.com/singer/psy it will also have another url movie.com/singer/psy (but this record is not displayed on movie.com it is just hidden )

and

full view of record "Weekly IDol" has this url: movie.com/tv-shows/weekly-idol it will also have url music.com/tv-shows/weekly-idol (but this record is not displayed on music.com it is just hidden )

So I will connect this two records from diferent sections via relation fields. But as you can understand this records are displayed on different sites so when I am on page: music.com/singer/psy I see record "PSY" which has related record "Weekly IDol" and if I will click on it it will redirect me to music.com/tv-shows/weekly-idol but I want to get redirected to movie.com/tv-shows/weekly-idol

So what is my question: Is it possible to add to each relation field template a code which will detect to what domain it redirects and change only domain name and then redirect ?

Last Modified: 23 Sep 2017


Sergey
Total posts: 13,748
21 Sep 2017 14:39

I has never worked with multisite.

I am not much of help here.


Giorgi625 VIP
Total posts: 655
21 Sep 2017 16:36

Ok forget about mightysites. I just mentioned it because I am using but normally it does not affect any joomla file except configuration.php.

Just answer me on this:

    <?php if(in_array($params->get('tmpl_core.item_link'), $this->user->getAuthorisedViewLevels())):?>            
            <a <?php echo $item->nofollow ? 'rel="nofollow"' : '';?> href="/<?php echo JRoute::_($item->url);?>">
        <?php echo $item->title?>                
            </a>                        
    <?php else:?>            
        <?php echo $item->title?>    
    <?php endif;?>    

So here on second line at the and we have href with link to record full view right?

How this url is generated?

If this code redirects me to url firstsite.com/section/item/record1

Can I change this code to let this link redirect me to secondsite.com/section/item/record1 ?


Giorgi625 VIP
Total posts: 655
21 Sep 2017 19:42

As I found in soutce of my site this code

href="<?php echo JRoute::_($item->url);

creates urls part without domain so I just hardcoded it and added domain manually liek this

href=" http://mysite.com< ;?php echo JRoute::_($item->url);

and it worked.


pepperstreet VIP
Total posts: 3,837
23 Sep 2017 00:30

Giorgi625 I just hardcoded it

};o

JURI::base(); should give you the domain

Older related article. https://www.minitek.gr/blog/how-to-get-the-current-page-url-in-joomla

Also mentioned in Docs article here:

where $url is the variable containing the full path to the javascript or CSS file for example: JUri::base() . 'templates/custom/js/sample.js'

Powered by Cobalt