We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 567
    • 8 Posts
    Hi,

    Not really sure exactly where I should / could have put this...

    Generally this is an inquiry about what the CSS should look like to accomplish my goal.
    It also ties in with how the modx page receives this information.

    I am looking for the ’best way’ to accomplish this, and realize that my attempts may have been made with false presumptions in how I structured my template, css, modx content.

    With this in mind, I am hoping the solution will be one, where the ’page builder’ would need to know next to ZERO about modx / html to accomplish the desired results... (basically just enough to put in the pictures / text).

    Right now, I have it set up in modX using 8 template variables.

    In the template I have put it inside the content div, for now, and overide its default positioning (to the left some pixels)

    Here is the template information that is relevant.
    <div id="pictureGroups">
       <div id="picGroup1">
          <div id="leftPic">
             [*#leftPic*]
          </div>
          <div id="rightPic">
             [*#rightPic*]
          </div>
       </div>
       <div id="picGroup2">
          <div id="leftPic">
             [*#leftPic2*]
          </div>
          <div id="rightPic">
             [*#rightPic2*]
          </div>
       </div>
       <div id="picGroup3">
          <div id="leftPic">
             [*#leftPic3*]
          </div>
          <div id="rightPic">
             [*#rightPic3*]
          </div>
       </div>
       <div id="picGroup4">
          <div id="leftPic">
             [*#leftPic4*]
          </div>
          <div id="rightPic">
             [*#rightPic4*]
          </div>
       </div>
       </div>


    So as you see above, I have leftPic1-4 and rightPic1-4 template variables. Likewise in my CSS I have similar. I have broken each set of pictures into groups, group 1,2,3, and 4. group one contains leftpic1 and rightpic1, etc. Now, leftpic1 may contain more than 1 picture, as can rightpic1... This is where alot of my problems come from.. (but certainly not all of them).


    /* Picture Frame Templates */
    
    #pictureGroups {
    position:relative;
    margin:0;
    padding:0;
    top:0;
    left:0;
    float:left;
    }
    
    #pictureGroups img {
    position:relative;
    padding: 0px 10px 0px 3px;
    }
    
    #picGroup1{
    position:relative;
    margin: 20px 0px 0px 0px;
    padding: 0px 0px 10px 0px;
    }
    #picGroup2{
    position:relative;
    padding: 0px 0px 10px 0px;
    }
    #picGroup3{
    position:relative;
    padding: 0px 0px 10px 0px;
    }
    #picGroup4{
    position:relative;
    padding: 0px 0px 90px 0px;
    }
    
    #leftPic{
    position:relative;
    top:0px;
    left:-160px;
    width:349px;
    border: 0 solid #000;
    border-bottom: 1px;
    }
    
    #rightPic{
    position:absolute;
    top:0px;
    left:250px;
    width:349px;
    border: 0 solid #000;
    border-bottom: 1px;
    }
    



    I have mocked up my desired output... I cannot get things to behave this way. with rightpic absolute, it ignores if more than one photo exists on the right side, with leftpic relative, it colapses all of the images ontop of eachother, etc etc.

    I’ve done some google searches looking for CSS ’table’ like layout etc.. but have not found the resource that will help me put this together... especially taking into consideration the modX element.

    I’ve attached an image of how the output should behave...

    The line separator part is not functioning at all in my code and has been subtituded with borders to the divs, just so i can see where each group is ending, atm.

    Some problems with the text may arise from modX putting paragraph tags around the images... This seems to be default behavior for the ’rich text’ template variable?

    I realize there is an image template variable, but as some ’groups’ contain more than 1 image per side, this was not desirable.



    Thanks in advance,
    Guy


    --edit
    (( I have found a couple links that seem to help me on the vertically aligned (centered) left and right sides...
    http://blog.themeforest.net/tutorials/vertical-centering-with-css/ and http://www.brunildo.org/test/vertmiddle.html )), Continuing to work on this trying to find a solution on my own as well... Will post back as progress is made...

      • 15022
      • 31 Posts
      I highly recommend that you use a table for this particular case. The markup and CSS code will be much simpler and the outcome more predictable and cross-browser friendly. Repost if you need help on how to do this.
        illegitimati non carborundum
        • 567
        • 8 Posts
        I’ll take a crack at it via tables as well...

        As I said, I’m looking for the BEST solution with the ’user’ in mind...

        one thing that is undesirable at the moment... is the way the ’rich text area’ template variables handle multiple images.

        If I put 2 images in ’leftpic2’ the images will look to be right upon each other on the entry screen. When in reality they do not display that way... (it is not ’wysiwyg’ at all).


        --Edit:

        Ok, it seems tables definitely help take the complication out of the styling required.
          • 567
          • 8 Posts
          Ok,

          For the most part I guess this is resolved.

          A few modX loose ends perhaps.

          If I wanted to be able to use variable # of images ’groups’ of say 1-5.

          So that there would be at most 5 groups of left/right pics.

          Could I, through modX, utilize just one template and only have the horizontal bar between groups show up if indeed there is a group below it (but not otherwise). (( without requiring ’page creator’ interaction ))
            • 15022
            • 31 Posts
            Hello again,
            You only need to change the HTML elements to "table" "tr" and "td" from your markup above and you can do away with almost all of the ID names you made.. they aren’t necessary.
            Your images are appearing on top of one another because you are not "clearing" the floated images. You could try floating all image elements to the left and all text elements to the right.. BUT this is far from a bulletproof solution and can break if users input something strange or unexpected.
            #pictureGroups img  { float: left; margin-right: 10px; clear: right }
            #pictureGroups p, #pictureGroups ul { float: right; clear: left }
            


            In order to do this reliably you need to enclose each image/text pair in a div so you are correct: the fact that your template variables can accept more than one image/text pair is responsible for this display problem.
            Can you rethink your user input and create more template variables? One for each image and one for each caption?
            I don’t know the requirements/constraints of your project so that is all the advice I can offer.
              illegitimati non carborundum
              • 567
              • 8 Posts
              Thank you for your replies Juliebug,

              The main reason I wanted to allow for multiple images, were cases where on a paticular ’image group’ the ’left’ image (or ’right’ image) was proportioned in such a way that there was an abundance of wasted space, that you could reclaim the space by using the opposite side w/ 2 images. so for instance, 1 portrait left, 2 landscapes right with ONE horizontal ’group’ separator.

              using a TV>image and tv>text schema in this example would lead me to think that i’d be restricted to a 1:1 relationship left to right on my ’groups’. (( unless I made multitudes of templates that accomodated multitudes of variations )).

              I do plan on having a few different ’picture’ templates, but for each ’major’ variation i’d much prefer ’one’ template to ’govern’ the rules.

              If I were to accomodate this w/ static templates I think i’d be looking at like 34 templates accounting for each groups quantity of photos left and right as well as if group 5,4,3,2 exist (for horizontal spacer line).


              Is there an easier way to accomplish this?