[Решение] Глупые ошибки PhocaGallery v2.8.0 - название сменилось, а ошибка осталось
В принципе эта ошибка была ещё в PhocaGallery v2.7.х
1 Error, 1 warning(s) Line 127, Column 14: character "<" is the first character of a delimiter but occurred as dataif (charLeft < 0) {
This message may appear in several cases:
- You tried to include the "<" character in your page: you should escape it as "<"
- You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe.
- Another possibility is that you forgot to close quotes in a previous tag.
А причина в том, что надо просто обернуть скрипты в CDATA)))
<script type="text/javascript">
здесь скрипт
</script>
вот так:
<script type="text/javascript">
//<![CDATA[
здесь скрипт
//]]>
</script>
Теперь где будем править эту ошибку:
/administrator/components/com_phocagallery/libraries/phocagallery/render/renderfront.php
стр. 52-81
Находим:
function renderCommentJS($chars) {
$tag = "<script type=\"text/javascript\">"
."function countChars() {" . "\n"
."var maxCount = ".$chars.";" . "\n"
."var pfc = document.getElementById('phocagallery-comments-form');" . "\n"
."var charIn = pfc.phocagallerycommentseditor.value.length;" . "\n"
."var charLeft = maxCount - charIn;" . "\n"
."" . "\n"
."if (charLeft < 0) {" . "\n"
." alert('".JText::_('You have reached maximum limit of characters allowed')."');" . "\n"
." pfc.phocagallerycommentseditor.value = pfc.phocagallerycommentseditor.value.substring(0, maxCount);" . "\n"
." charIn = maxCount;" . "\n"
." charLeft = 0;" . "\n"
."}" . "\n"
."pfc.phocagallerycommentscountin.value = charIn;" . "\n"
."pfc.phocagallerycommentscountleft.value = charLeft;" . "\n"
."}" . "\n"
."function checkCommentsForm() {" . "\n"
." var pfc = document.getElementById('phocagallery-comments-form');" . "\n"
." if ( pfc.phocagallerycommentstitle.value == '' ) {". "\n"
." alert('". JText::_( 'Please enter a title' )."');". "\n"
." return false;" . "\n"
." } else if ( pfc.phocagallerycommentseditor.value == '' ) {". "\n"
." alert('". JText::_( 'Please enter a comment' )."');". "\n"
." return false;" . "\n"
." } else {". "\n"
." return true;" . "\n"
." }" . "\n"
."}". "\n"
."</script>";
return $tag;
}
Правим:
function renderCommentJS($chars) {
$tag = "<script type=\"text/javascript\">//<![CDATA["
."function countChars() {" . "\n"
."var maxCount = ".$chars.";" . "\n"
."var pfc = document.getElementById('phocagallery-comments-form');" . "\n"
."var charIn = pfc.phocagallerycommentseditor.value.length;" . "\n"
."var charLeft = maxCount - charIn;" . "\n"
."" . "\n"
."if (charLeft < 0) {" . "\n"
." alert('".JText::_('You have reached maximum limit of characters allowed')."');" . "\n"
." pfc.phocagallerycommentseditor.value = pfc.phocagallerycommentseditor.value.substring(0, maxCount);" . "\n"
." charIn = maxCount;" . "\n"
." charLeft = 0;" . "\n"
."}" . "\n"
."pfc.phocagallerycommentscountin.value = charIn;" . "\n"
."pfc.phocagallerycommentscountleft.value = charLeft;" . "\n"
."}" . "\n"
."function checkCommentsForm() {" . "\n"
." var pfc = document.getElementById('phocagallery-comments-form');" . "\n"
." if ( pfc.phocagallerycommentstitle.value == '' ) {". "\n"
." alert('". JText::_( 'Please enter a title' )."');". "\n"
." return false;" . "\n"
." } else if ( pfc.phocagallerycommentseditor.value == '' ) {". "\n"
." alert('". JText::_( 'Please enter a comment' )."');". "\n"
." return false;" . "\n"
." } else {". "\n"
." return true;" . "\n"
." }" . "\n"
."}". "\n"
."//]]></script>";
return $tag;
}
Всё!
Можно ещё поиграться с этим:
ст. 382-397
switch ($slideshow) {
case 1:
$tag .= ' if (hs.addSlideshow) hs.addSlideshow({ '."\n"
.' slideshowGroup: \''.$typeOutput.$slideShowGroup.'\','."\n"
.' interval: 5000,'."\n"
.' repeat: false,'."\n"
.' useControls: true,'."\n"
.' fixedControls: true,'."\n"
.' overlayOptions: {'."\n"
.' opacity: 1,'."\n"
.' position: \'top center\','."\n"
.' hideOnMouseOut: true'."\n"
.' }'."\n"
.' });'."\n";
break;
И изменить его так:
switch ($slideshow) {
case 1:
$tag .= ' if (hs.addSlideshow) hs.addSlideshow({ '."\n"
.' slideshowGroup: \''.$typeOutput.$slideShowGroup.'\','."\n"
.' interval: 5000,'."\n"
.' repeat: false,'."\n"
.' useControls: true,'."\n"
.' fixedControls: \'fit\','."\n"
.' overlayOptions: {'."\n"
.' opacity: .75,'."\n"
.' position: \'bottom center\','."\n"
.' hideOnMouseOut: true'."\n"
.' }'."\n"
.' });'."\n";
break;
Ещё некоторый бег, я не совсем уверен в его правильности, но он работает:
/components/com_phocagallery/views/category/tmpl/default.php
ст. 274-280
echo '<div><ul class="star-rating-small">'
.'<li class="current-rating" style="width:'.$value->voteswidthimg.'px"></li>'
.'<li><span class="star1"></span></li>';
for ($iV = 2;$iV < 6;$iV++) {
echo '<li><span class="stars'.$iV.'"></span></li>';
}
echo '</ul></div>';
echo '</a></div>';
Правим на:
echo '<object><ul class="star-rating-small">'
.'<li class="current-rating" style="width:'.$value->voteswidthimg.'px"></li>'
.'<li><span class="star1"></span></li>';
for ($iV = 2;$iV < 6;$iV++) {
echo '<li><span class="stars'.$iV.'"></span></li>';
}
echo '</ul></object>';
echo '</a></div>';
Решил
Элемент <object> сообщает браузеру, как загружать и отображать объекты, которые исходно браузер не понимает. Как правило, такие объекты требуют подключения к браузеру специального модуля, который называются плагин, или запуска вспомогательной программы.
правим
/components/com_phocagallery/views/category/tmpl/default.php
стр. 547-563
Ищем:
echo '<div><ul class="star-rating-small">'
.'<li class="current-rating" style="width:'.$value->voteswidthimg.'px"></li>'
.'<li><span class="star1"></span></li>';
for ($iV = 2;$iV < 6;$iV++) {
echo '<li><span class="stars'.$iV.'"></span></li>';
}
echo '</ul></div>';
echo '</a></div>';
}
правим:
echo '<object><ul class="star-rating-small">'
.'<li class="current-rating" style="width:'.$value->voteswidthimg.'px"></li>'
.'<li><span class="star1"></span></li>';
for ($iV = 2;$iV < 6;$iV++) {
echo '<li><span class="stars'.$iV.'"></span></li>';
}
echo '</ul></object>';
echo '</a></div>';
}
Validatuon 100%
