I have managed to set the min and max widths of my blocks in the index.php file. Please forgive me if there is a better way of doing this.
I edited the following code:
// Bounds for block widths
// more flexible for theme designers taken from theme config.php
$lmin = (empty($THEME->block_l_min_width)) ? 195 : $THEME->block_l_min_width;
$lmax = (empty($THEME->block_l_max_width)) ? 195 : $THEME->block_l_max_width;
$rmin = (empty($THEME->block_r_min_width)) ? 220 : $THEME->block_r_min_width;
$rmax = (empty($THEME->block_r_max_width)) ? 250 : $THEME->block_r_max_width;
define('BLOCK_L_MIN_WIDTH', $lmin);
define('BLOCK_L_MAX_WIDTH', $lmax);
define('BLOCK_R_MIN_WIDTH', $rmin);
define('BLOCK_R_MAX_WIDTH', $rmax);
Thsi works a treat apart from the fact that when I navigate of the front page, i.e. in to a course both righthand and left blocks or columns just revent back to there original size.
Any ideas what might be wrong here. I have clearly edited the wrong file and should have found the correct sytle declaration
Thanks in advance
Bump
Sorry but this one is getting on my nerves
Thanks
Sorry but this one is getting on my nerves
Thanks
Paul,
(Missed this first time round)
There are several places where the structure you edited appears, and you might need to change each of them if you use your approach.
However, if you put index.php back how it was and only edit the special config.php FROM WITHIN YOUR THEME DIRECTORY, you can add...
$THEME->block_l_max_width = 190 etc etc.
...to that file and it should be picked up by all.
If you are going to min=max this way you would need to test on PCs in IE and Firefox, as well as Macs in Safari and FF (or more particularly test at all resolutions from 800 wide to 1680 wide if there is any chance of your users coming in on such) to see whether you create as many problems as you solve!
Regards,
John
(Missed this first time round)
There are several places where the structure you edited appears, and you might need to change each of them if you use your approach.
However, if you put index.php back how it was and only edit the special config.php FROM WITHIN YOUR THEME DIRECTORY, you can add...
$THEME->block_l_max_width = 190 etc etc.
...to that file and it should be picked up by all.
If you are going to min=max this way you would need to test on PCs in IE and Firefox, as well as Macs in Safari and FF (or more particularly test at all resolutions from 800 wide to 1680 wide if there is any chance of your users coming in on such) to see whether you create as many problems as you solve!
Regards,
John
Hi and thanks for your reply
I have put the index.php back to as it was and pasted the changed code to my config file in the themes directory.
Now whilst you are right that this has worked to the stage that my old theming worked, i.e. the frontpage blocks are the right width, however if i to any other pages such as course pages the blocks revert to there original size.
So whilst it still works if i put this code into the config file in the themes directory I stil have the same problem.
If it makes any difference I am using the foodle theme as a base
Thanks for your help, im sure that I will solve this issue given time
Thanks again
Paul
I have put the index.php back to as it was and pasted the changed code to my config file in the themes directory.
Now whilst you are right that this has worked to the stage that my old theming worked, i.e. the frontpage blocks are the right width, however if i to any other pages such as course pages the blocks revert to there original size.
So whilst it still works if i put this code into the config file in the themes directory I stil have the same problem.
If it makes any difference I am using the foodle theme as a base
Thanks for your help, im sure that I will solve this issue given time
Thanks again
Paul
Paul,
This seems a bit of a puzzle to me, does that mean that your theme does not apply in the course page???
Try getting your pages to 'echo' the value of $THEME->block_l_min_width etc.
such as adding
echo '(' . $THEME->block_l_min_width . ')';
to /course/view.php
to see if its losing track of the values.
AFAIK, the pages that actually display blocks other than the admin setup of, say, sticky blocks, and quiz blocks etc., they all sandwich the values between those limits.
Regards,
John
This seems a bit of a puzzle to me, does that mean that your theme does not apply in the course page???
Try getting your pages to 'echo' the value of $THEME->block_l_min_width etc.
such as adding
echo '(' . $THEME->block_l_min_width . ')';
to /course/view.php
to see if its losing track of the values.
AFAIK, the pages that actually display blocks other than the admin setup of, say, sticky blocks, and quiz blocks etc., they all sandwich the values between those limits.
Regards,
John
No my theme is definatly working throug out my site just the course block widths are still showing there original size since since I changed the config.php in my theme
I will try what you suggest and see what is being sent through
Thanks again
I will try what you suggest and see what is being sent through
Thanks again
just a pair of brackets ()
So I assume that these values are not being passed on
Ill look in to this
Paul
So I assume that these values are not being passed on
Ill look in to this
Paul
Ah no my mistake. The course block width is correct!
What I have done is add a course and added some resources (web page), to each topic section so I can link directly to these pages from within the html block.
What is happening is the webpage created as a resource has the smaller blocks and doesnt seem to be effected by the code added to the config in the theme.
Sorry, but this just means I am further away from achieing my goals.
Anyway thanks for you help its much appreciated
Paul
What I have done is add a course and added some resources (web page), to each topic section so I can link directly to these pages from within the html block.
What is happening is the webpage created as a resource has the smaller blocks and doesnt seem to be effected by the code added to the config in the theme.
Sorry, but this just means I am further away from achieing my goals.
Anyway thanks for you help its much appreciated
Paul
Ahah!
It is an odd thing, but in MOST places the value of $preferred_width_left is a value bounded by BLOCK_L_MIN_WIDTH and BLOCK_L_MAX_WIDTH as you have discovered (and similarly with right side).
But in some places these limits appear to be hard-coded as 180 and 210, with the obvious issue that your theme values can't intervene. I find this surprising!
The specific files where this is so are...
/admin/stickyblocks.php (should only affect the 'admin' view of stickies)
/mod/chat/view.php
/mod/data/view.php
/mod/lesson/view.php
/mod/lesson/action/continue.php
/mod/quiz/view.php
/mod/resource/lib.php (I'm fairly certain this one affects your web resource)
/my/index.php (for My Moodle)
/tag/index.php
So perhaps you should edit /mod/resource/lib.php and insert something like...
$lmin = (empty($THEME->block_l_min_width)) ? 180 : $THEME->block_l_min_width;
$lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width;
define('BLOCK_MIN_WIDTH', $lmin);
define('BLOCK_MAX_WIDTH', $lmax);
Then in /mod/resource/lib.php change...
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
...to read...
$blocks_preferred_width = bounded_number(BLOCK_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_MAX_WIDTH);
(no left-right distinction is needed here)
Regards,
John
PS: This MAY also require...
global $THEME
...near the start of the file, but you can try without first.
It is an odd thing, but in MOST places the value of $preferred_width_left is a value bounded by BLOCK_L_MIN_WIDTH and BLOCK_L_MAX_WIDTH as you have discovered (and similarly with right side).
But in some places these limits appear to be hard-coded as 180 and 210, with the obvious issue that your theme values can't intervene. I find this surprising!
The specific files where this is so are...
/admin/stickyblocks.php (should only affect the 'admin' view of stickies)
/mod/chat/view.php
/mod/data/view.php
/mod/lesson/view.php
/mod/lesson/action/continue.php
/mod/quiz/view.php
/mod/resource/lib.php (I'm fairly certain this one affects your web resource)
/my/index.php (for My Moodle)
/tag/index.php
So perhaps you should edit /mod/resource/lib.php and insert something like...
$lmin = (empty($THEME->block_l_min_width)) ? 180 : $THEME->block_l_min_width;
$lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width;
define('BLOCK_MIN_WIDTH', $lmin);
define('BLOCK_MAX_WIDTH', $lmax);
Then in /mod/resource/lib.php change...
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
...to read...
$blocks_preferred_width = bounded_number(BLOCK_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_MAX_WIDTH);
(no left-right distinction is needed here)
Regards,
John
PS: This MAY also require...
global $THEME
...near the start of the file, but you can try without first.
Well that works a treat and thankyou very much for your help on this matter it is much appreciated.
You mention that there is no left-right distinction needed in the code that you have so kidley written for me. However I do need the lefthand blocks ro be 195 and the righthand ones to 220
I can probably work this out so ill have a look at what you have done
Thanks again John
You mention that there is no left-right distinction needed in the code that you have so kidley written for me. However I do need the lefthand blocks ro be 195 and the righthand ones to 220
I can probably work this out so ill have a look at what you have done
Thanks again John
We're creating some new Moodle Themes.
This post has reviled one of the reasons editing a moodle theme is a complete nightmare!!
Hardcoded php values, tut, tut, tut....that's annoying!
Steve
www.sheilds-elearning.co.uk
This post has reviled one of the reasons editing a moodle theme is a complete nightmare!!
Hardcoded php values, tut, tut, tut....that's annoying!
Steve
www.sheilds-elearning.co.uk
We are planning to make it suck less in Moodle 2.0. See Navigation 2.0.
In the mean time, please try to relax and don't let it stress you
In the mean time, please try to relax and don't let it stress you
Good becuase im still stuck with changing there width in the resource modules
Cheers Guys
Cheers Guys
Paul,
That is certainly what () means, but perhaps only because I didn't tell you to put...
global $THEME
near the top of that file!!
John
That is certainly what () means, but perhaps only because I didn't tell you to put...
global $THEME
near the top of that file!!
John