0
Welcome Guest! Login
0 items Join Now

SOLVED Feature position order

    • IDN's Avatar
    • IDN
    • Newbie
    • Posts: 16
    • Thanks: 4
    • Joomla! & WP Expert

    SOLVED Feature position order

    Posted 9 years 10 months ago
    • Is there a way to state that a feature is loaded after the modules on a specific position?
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13481
    • Web Designer/Developer

    Re: SOLVED Feature position order

    Posted 9 years 10 months ago
    • Could you please post a URL to your site (this can be done in the secure area tab if you prefer) so we can look for you. Without a link to page where the problem is on your site it is quite hard for us to provide the best solution due to so many variables. We try to provide file names and line numbers for code changes and if changes have already been made then our advice may be incorrect.

      Please do a screengrab of your problem and annotate to make it clear.

      I'm not sure what you mean at all?

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.
    • IDN's Avatar
    • IDN
    • Newbie
    • Posts: 16
    • Thanks: 4
    • Joomla! & WP Expert

    Re: SOLVED Feature position order

    Posted 9 years 10 months ago
    • Thank you for youre reply but i have found what i was looking for.

      I had searched before but couldn't found what i was looking for but a brainf*rt gave me an idea that has resulted in a solution.

      See the attachment:
      1 is the feature "fontsizer" and 2 is a module in de top-c position. This feature and module needed to be on the same position but not in this order. To be able to make this possible i have altered the code a little bit and came with a quick solution that can be changed in the template manager.

      In the second screenshot you can see i have added a dropdown menu with the question to show before or after the module position.

      The code is set up quickly for a fast result it's not the most streamlined.

      As you can see below i have added a switch to determine where the position should be placed and before the $contents is set i add the $before and $after variable to it.

      Hopes this also explaines what i was talking about.

      libraries/gantry/core/renderers/gantrymodulesrenderer.class.php: 62
      if (!empty($features) && count($features) > 0) {
      	foreach ($features as $feature_name) {
      		$feature          = $gantry->getFeature($feature_name);
      		$rendered_feature = $feature->render($position);
      
      		if (!empty($rendered_feature)) {
      			switch ($feature->get('position-module')) {
      
      				case 'after':
      					$after .= $rendered_feature . "\n";
      					break;
      				
      				default:
      				case 'before':
      					$before .= $rendered_feature . "\n";
      					break;
      			}
      		}
      	}
      }
      
      if (!empty($modules) && count($modules) > 0) {
      	$shortname = $gantry->getShortName($position);
      	$contents = $before . '<jdoc:include type="modules" name="' . $position . '" style="' . $chrome . '" />' . "\n" . $after;
      }else{
      	$contents = $before . $after;
      }

      template-options.xml
      <fields name="fontsizer" type="chain" label="FONT_SIZER" description="FONT_SIZER_DESC">
                  <field name="enabled" type="toggle" default="0" label="SHOW"/>
                  <field name="position" type="position" translation="false" default="feature-b" label="POSITION"/>
                  <field name="position-module" type="selectbox" default="before" label="Insert before modules or after?" description="Insert before modules or after">
                      <option value="before">Before</option>
                      <option value="after">After</option>
                  </field>
              </fields>
    • Last Edit: 9 years 10 months ago by IDN.
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13481
    • Web Designer/Developer

    Re: SOLVED Feature position order

    Posted 9 years 10 months ago
    • Ok well in my opinion it is not the right thing to do to hack gantry. I would look for you but you have not posted a url to your site - I'm sure there is a better CSS solution to this rather than hacking gantry and making taking updates difficult (because updates will overwrite yout changes).

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.
    • IDN's Avatar
    • IDN
    • Newbie
    • Posts: 16
    • Thanks: 4
    • Joomla! & WP Expert

    Re: SOLVED Feature position order

    Posted 9 years 10 months ago
    • That is why if have posted the code so you could see what i have done and maybe adding a little flexibility to the placement of features.

      This would greatly improve the feature placement with 2 small clicks instead of using multiple rows of css to get div 1 below div 2. CSS does not seem to be a solution for this.

      In the example below is the current(old) state and we need block-1 after block-2 but it also has to respond well in terms of other blocks dynamically added and screen resolution and so on...
      <div id="block-1">
          <p>Lorem ipsum</p>
      </div>
      <div id="block-2">
          <p>Lorem ipsum</p>
      </div>

      The simplest thing to do is shown in the example below, which can be done if the earlier given code is taken in to gantry (bit more refined ofcourse).
      <div id="block-2">
          <p>Lorem ipsum</p>
      </div>
      <div id="block-1">
          <p>Lorem ipsum</p>
      </div>

      The link is not very useable anymore because it has been fixed wit a little bit of code.
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13481
    • Web Designer/Developer

    Re: SOLVED Feature position order

    Posted 9 years 10 months ago
    • Fair enough it's your site. I still disagree though... but if you have any suggestions for improving gantry please raise a topic in the "requests" forum - that's where the DEVS will look for good ideas. Thanks for suggestion though.

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.

Time to create page: 0.057 seconds