Word wrapping the course name

Re: Word wrapping the course name

by Ken Gibson -
Number of replies: 0
Hey Leslie,

Sorry for the missed bracket (thanks Raymond for the catch). The Code I posted also cuts the classname at 100 characters regardless (should have posted this...see below).

//------ABOVE THE PRINT CODE------
$classname = wordwrap($classname, 75, "<br />\n"); //wrap at 75 characters

//Pull out text before and after the <br /> in the wrap
if ($pos = strpos($classname, "<br />")){ //look for the <br/>
$classname1 = substr($classname, 0, $pos); //make $classname1 everything before that <br/>
$classname2 = substr($classname, $pos+5); //make $classname2 everything after that <br/> - the $pos+5 is 5 characters past start of <br/>
}

//------IN THE PRINT CODE-------
if ($classname1) {
cert_printtext(170, 330, 'C', 'Helvetica', '', 20, utf8_decode($classname1));
}
else {
cert_printtext(170, 330, 'C', 'Helvetica', '', 20, utf8_decode($classname));
}
if ($classname2) {
cert_printtext(170, 370, 'C', 'Helvetica', '', 20, utf8_decode($classname2));
}