Submenu - short description
Submenu - short description
Help make a short description for Submenu like in the picture. How to get the first line of text? [ external image ]
Re: Submenu - short description
Hi baglov,
basically that's very simple. You have to edit cmsimple/cms.php, and edit function li() (line 459 in CMSimple 3.3). On the first line (line 460) you have to add $c, so it reads:
Before line 507 you have to insert:
It's probably not possible to display exactly the first line of the page, but this script allows you to display the first 50 characters of the page (have a look at the commented line, where you can change 50 to any number you like).
BTW: You might have a look at CMSimple_XH 1.5.1 (basically the same as CMSimple 3.3, but some improved features).
Christoph
basically that's very simple. You have to edit cmsimple/cms.php, and edit function li() (line 459 in CMSimple 3.3). On the first line (line 460) you have to add $c, so it reads:
Code: Select all
global $s, $l, $h, $cl, $cf, $u, $c;
Code: Select all
elseif ($st == 'submenu') {
$temp = preg_replace("/".$cf['scripting']['regexp']."/is", "", preg_replace("/.*<\/h[1-".$cf['menu']['levels']."]>/i", "", $c[$ta[$i]]));
$t .= '—'.substr(strip_tags($temp), 0, 50); // replace 50 with the number of characters to display
}
else $t .= '</li>'; // this line is already there
BTW: You might have a look at CMSimple_XH 1.5.1 (basically the same as CMSimple 3.3, but some improved features).
Christoph
Christoph M. Becker – Plugins for CMSimple_XH
Re: Submenu - short description
Thank you very much CMB. It worked. I approximately thought about this. But had problems with line 507.
Thanks for the advice about CMSimple_XH 1.5.1 really many interesting features.
Thanks for the advice about CMSimple_XH 1.5.1 really many interesting features.
Re: Submenu - short description
Hi baglov,
Christoph
Some months ago I was trying to do something similar: a submenu as teasers (as know from Joomla). So I already had some code at hand.baglov wrote:I approximately thought about this. But had problems with line 507.
Christoph
Christoph M. Becker – Plugins for CMSimple_XH
Re: Submenu - short description
Hey baglov/cmb
to add to this, using a similar concept would it be possible to show a small picture next to each submenu heading? (maybe have the image stored in your img/media folder with the same title as the h1/2/3/4 tag)
its not a big issue as i dont actually show the submenu on any page, but it could come in handy for future designs in my template
KR
flukey
edit: added h2, h3 and h4 tag as i remembered not every page is a h1
to add to this, using a similar concept would it be possible to show a small picture next to each submenu heading? (maybe have the image stored in your img/media folder with the same title as the h1/2/3/4 tag)
its not a big issue as i dont actually show the submenu on any page, but it could come in handy for future designs in my template
KR
flukey
edit: added h2, h3 and h4 tag as i remembered not every page is a h1
RJS Electronics Ltd - LED Push Switches, LCD Programmable Keys, Anti Vandal Push Buttons, Relays, Custom Cable Assemblies
Visit my Web Hosting / Design website here - www.flukedesigns.co.uk
Visit my Web Hosting / Design website here - www.flukedesigns.co.uk
Re: Submenu - short description
Hi flukey,
But you have to take care, that the heading doesn't contain characters that are not allowed for the file system. Spaces will probably no problem, but slashes for example won't work.
Christoph
Yes, that's possible.flukey92 wrote:using a similar concept would it be possible to show a small picture next to each submenu heading?
Code: Select all
elseif ($st == 'submenu') {
$temp = preg_replace("/".$cf['scripting']['regexp']."/is", "", preg_replace("/.*<\/h[1-".$cf['menu']['levels']."]>/i", "", $c[$ta[$i]]));
$t .= tag('img src="'.$pth['folder']['images'].$h[$ta[$i]].'" alt=""');
}
else $t .= '</li>'; // this line is already there
Christoph
Christoph M. Becker – Plugins for CMSimple_XH
Re: Submenu - short description
You my friend are a legend cheeky question how to make it automatically have the size of say 50px?
would this be correct?
also how do you make your code coloured when your posting?
flukey
would this be correct?
Code: Select all
elseif ($st == 'submenu') {
$temp = preg_replace("/".$cf['scripting']['regexp']."/is", "", preg_replace("/.*<\/h[1-".$cf['menu']['levels']."]>/i", "", $c[$ta[$i]]));
$t .= tag('img src="'.$pth['folder']['images'].$h[$ta[$i]].'" height="50px" alt=""');
}
else $t .= '</li>'; // this line is already there
flukey
RJS Electronics Ltd - LED Push Switches, LCD Programmable Keys, Anti Vandal Push Buttons, Relays, Custom Cable Assemblies
Visit my Web Hosting / Design website here - www.flukedesigns.co.uk
Visit my Web Hosting / Design website here - www.flukedesigns.co.uk
Re: Submenu - short description
Hi flukey,
Christoph
Basically yes. But I'm not sure, if the width of the image will resize automatically, so the image might be distorted without giving a widht="..." too.flukey92 wrote:would this be correct?
Instead of [ code ], just write [ code=php ] (without the spaces), what will only work well for PHP code.flukey92 wrote:also how do you make your code coloured when your posting?
Christoph
Christoph M. Becker – Plugins for CMSimple_XH
Re: Submenu - short description
Thanks for that,
And typically AFAIK you don't need to state either width or height for any image,
for a random picture of say 150px * 300 px these attributes should do the following
Height="50px" picture:25px * 50px
Width="50px" picture:50px * 100px
No attributes picture: original size dimensions
Width="100%" the image will fill the width of its container, and the height at a ratio equivalent to the original dimensinos
Height 100% the image will fill the height of its container, and the width at a ratio equivalent to the original dimensions
KR
flukey
p.s. the most important thing when using different sized images (using just the one code) is stating only one dimensions so that they are all either the same height or width but none of them distorted/skewed
Using the height attribute id feel would make the output of the submenu more evenly spaced.
hope i got that right
And typically AFAIK you don't need to state either width or height for any image,
for a random picture of say 150px * 300 px these attributes should do the following
Height="50px" picture:25px * 50px
Width="50px" picture:50px * 100px
No attributes picture: original size dimensions
Width="100%" the image will fill the width of its container, and the height at a ratio equivalent to the original dimensinos
Height 100% the image will fill the height of its container, and the width at a ratio equivalent to the original dimensions
KR
flukey
p.s. the most important thing when using different sized images (using just the one code) is stating only one dimensions so that they are all either the same height or width but none of them distorted/skewed
Using the height attribute id feel would make the output of the submenu more evenly spaced.
hope i got that right
RJS Electronics Ltd - LED Push Switches, LCD Programmable Keys, Anti Vandal Push Buttons, Relays, Custom Cable Assemblies
Visit my Web Hosting / Design website here - www.flukedesigns.co.uk
Visit my Web Hosting / Design website here - www.flukedesigns.co.uk
Re: Submenu - short description
Hi flukey,
Christoph
Yes! I wasn't able to find the specification what should happen, when a width is given without a height, or vice versa, but I tested in different browsers, and all of them did scale the image proportionally.flukey92 wrote:hope i got that right
Christoph
Christoph M. Becker – Plugins for CMSimple_XH