We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8287
    • 12 Posts
    A couple years ago I developed a single-website that grew to a multi-website design. The code/db is ASP/MySQL. The problem ... it is messy and doesn’t really have a good admin backend or user authentication system.

    I started looking at CMSystems and have tested *many* but they all seemed to be lacking in one way or another. Then I came across Etomite which led to MODx. MODx appears to have the enhancement tools to work with plus it has the webusers & admins separated. Creating and assigning roles/groups/permissions was especially exciting to me.

    I was hoping to get some insite & direction from the experienced Eto/MODx gurus. How feasible would it be to implement the multi-website design I have laid out below (see graphic) using MODx? The approach for administering everything under a single admin login is a low priority. My main interest is in two areas:

    1) Using the same webuser authentication for multiple sites.
    ? ?(each site could be a separate install)

    2) A business directory that can be accessed by all the sites.
    ? ?a) Could this be a separate site of its own and then just wrap it into each site?
    ? ?b) Need some kind of menuing system that would show multi-level categories.
    ? ?c) Need to be able to assign each business to multiple categories.
    ? ?d) Like many link directory software but pointing to documents I create for businesses.
    ? ? ? (MosDirectory worked well but it was for Mambo which lacked good user granularity)

    Can anyone give me some ideas on ways to accomplish this? Is it possible using MODx? I have liked what I have seen so far in MODx.

    Thanks in advance.
    Dennis

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Yes and yes wink

      For multiple sites, just specify the same database information as you run the setup utility for each site.

      There is "wrapper" snippet if you really need to include external pages into a MODx site, or you can do as I did with the Olate download system: have the link on your main MODx menu be a "weblink" instead of a regular document, and point it to the external installation. Of course, I have to log in to Olate through its own manager login to administer it, but that’s really not a big deal when you’re dealing with a major package like that.

      The core developers will probably have more specific remarks, but yes, what you want is most definitely do-able. And I chose MODx because it is really easy even for a hobby-hacker like me to customize without meddling in the core scripts, and getting easier every few weeks as it’s updated.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 8287
        • 12 Posts
        Thanks for the response.

        One question I still have is ... if I use the same database for each of the installed sites, how do I keep the content separate? I don’t want content written for URL1 to show up when a visitor comes in through URL2. Is that possible if you are using the same database for all the sites? I can understand where using the same database will enable the webusers to have access to all the sites. That is also something that I am needing.

        Dennis
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Each document has a unique ID, and a document can also serve as the parent of other documents, thus forming a "tree", with a parent document acting as a "folder" for its children, and their children.

          The menu generation code is passed a document ID to act as the root from which it generates the menu. I did much the same thing in a multilanguage site http://www.bmptrans.ch.

          The document whose ID is used as "root" for a menu generation script does not need to be visible. Thus, each of your separate sites would simply be stored "under" its own unpublished document, and the menu script would be passed the ID of its folder to use as its root. I suppose it would require some careful design thought to keep the document tree organized in the Manager, but certainly not difficult. If you have four separate sites, you could have four unpublished "folder" documents in the main root, (parent 0), and have each site’s content in its own folder. You can create a document group for each site, and assign the documents for that site to that group, and only allow the admin user for each site access to the pages on that group of documents.

          The only issue I can see is the "site_start" default site entry document; perhaps have that be a single page with links to the other sites?
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 8287
            • 12 Posts
            Thanks, Sottwell ... I never thought of taking that approach. That is really cool and seems like it would work in accomplishing what I need.

            The other part I’m not quite clear on how to do is with the business directory. What I would like is something like phpMyDirectory (http://www.phpmydirectory.com/demo/index.php). I need to be able to assign each business to multiple categories with the category levels acting as the menu links to the businesses in the selected category. I want to be able to limit some of the business information to the public and provide more information to registered users.

            Could this be done with the basics of MOdx or would it require writing special code? Is there already something available that you know of?
              • 32963
              • 1,732 Posts
              You might have to create a snippet to handle the directory listing. As for nest categoried you can use folders as categories to nest you documents
                xWisdom
                www.xwisdomhtml.com
                The fear of the Lord is the beginning of wisdom:
                MODx Co-Founder - Create and do more with less.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Well, you actually could do a listing as you suggested, using the modx document tree system as your category structure, and when you need to have a business’s page in more than one category ("folder" in this case) just put in a weblink page for it pointing at its real document ID. Manage user access with the web user and document group permissions system. Use one of the recursive menu generators giving it the parent document of the root level of your directory listings as its ID.

                You could even have each category’s "folder" be a document describing the category and containing a menu snippet to display the entries and subcategories it contains. It would be a very interesting excercise in making the user and document group permissions and the way modx handles its document ’tree’ go full stretch!
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 8287
                  • 12 Posts
                  Thanks to both of you for your replies. I will have to work with MOdx some more and try out these approaches. If other questions arise concerning implementing this, I will post them here.

                  If anyone else has a different idea on how to handle this, please feel free to pass it on.

                  Thanks again.
                  Dennis
                    • 8287
                    • 12 Posts
                    Can anyone give me some suggestions? I am new to MODx & am ramping up on PHP.

                    As I mentioned above, I would like to admin mulitple sites from one installation so I can share the webuser access and a directory application to be put together.

                    I have played with the following code and it gives me the switch I want depending on which URL the visitor comes in from. I thought all I would need to do is to change the variable *site_start* to the appropriate document. Not being that familiar with the MODx code, my problem is that I’m not sure where to include it to make it happen. I had put it in /manager/includes/config.inc.php but that didn’t work. I tried a few other files but with no success.

                    Also, how would you get around MODx wanting to read the data from /assets/cache/siteCache.idx?

                    Here is the include file I was trying to use:

                    <?php
                    $MYURL = $_SERVER[’SERVER_NAME’];

                    if (ereg(’myfirsturl’,$MYURL))
                    ? {
                    ? ?// this watches for www.myfirsturl.com or myfirsturl.com
                    ? ?$this->config[’site_start’] = "10";
                    ? }
                    elseif (ereg(’mysecondurl’,$MYURL))
                    ? {
                    ? ?// this watches for www.mysecondurl.com or mysecondurl.com
                    ? ?$this->config[’site_start’] = "15";
                    ? }
                    elseif (ereg(’mythirdurl’,$MYURL))
                    ? {
                    ? ?// this watches for www.mythirdurl.com or mythirdurl.com
                    ? ?$this->config[’site_start’] = "20";
                    ? }
                    ?>

                    If anyone has any other approaches, I would appreciate them greatly.

                    Thanks,
                    Dennis
                      • 22927
                      • 19 Posts
                      I am no guru...

                      Why not install modx 4 times? Each modx on its own url using the same database?
                      Then use 4 diff templates each containing the menu routine with the proper page_id ?

                      Cache, you could disable caching per content item.

                      Good luck