gangboy23 Posted November 1, 2010 Share Posted November 1, 2010 Hi everyone, I'm trying to make some changes in ReadLess plugin in joomla. But I can't make that changes what I want. Maybe I don't know how. This plugin is make to cut intro text, cut title, and it can shows pictures for specified dimensions with links. And this plugin is only way to show my articles in my joomla site how I want. Problem with this plugin is that the people who make it, puts some lines in the code, and not registered people can't see the articles. It is allowed only for registered users. I want to both can see the articles. The original code is : function _PopFirstImage( &$row, &$params, $page ) { $firstImageHtml = ''; if ( $this->params->get( 'moveFirstImage', true ) ) { if ( preg_match( self::_imageTagPattern, $row->text, $matches ) > 0 ) { $imageCode = $matches[0]; $imageUrl = $matches[1]; } if ( isset( $imageUrl ) ) { $makeImageLinkToArticle = $this->params->get( 'makeImageLinkToArticle', true ); if ( $makeImageLinkToArticle ) { /* Guests who receive a different trailing text than registered users * may not see a linked image. */ $user =& JFactory::getUser(); if ( ( $user->guest == 1 ) && ( JString::strlen( $this->params->get( 'trailingTextForGuests', '' ) ) > 0 ) ) { $makeImageLinkToArticle = false; } } if ( $makeImageLinkToArticle ) { $firstImageHtml .= '<a href="index.php?option=com_content&view=article&id='.$row->id.'">'; } $attributes = self::_GetImageAttributes( $row->title ); $firstImageHtml .= '<img src="' . $imageUrl. '"' . $attributes . '/>'; if ( $makeImageLinkToArticle ) { $firstImageHtml .= '</a>'; } /* Remove the code for the image on the old location. */ $start = JString::strpos( $row->text, $imageCode ); $row->text = JString::substr_replace( $row->text, '', $start, JString::strlen( $imageCode ) ); } else { /* No image was found. There is no image to move in front of the article. * Nothing to do. */ } } else { /* Don't hunt for an image, don't move it first in the article. * Nothing to do. */ } return $firstImageHtml; } I've made some changes in some lines, and it looks like this : function _PopFirstImage( &$row, &$params, $page ) { $firstImageHtml = ''; if ( $this->params->get( 'moveFirstImage', true ) ) { if ( preg_match( self::_imageTagPattern, $row->text, $matches ) > 0 ) { $imageCode = $matches[0]; $imageUrl = $matches[1]; } if ( isset( $imageUrl ) ) { $makeImageLinkToArticle = $this->params->get( 'makeImageLinkToArticle', true ); if ( $makeImageLinkToArticle ) { /* Guests who receive a different trailing text than registered users * may not see a linked image. */ $user =& JFactory::getUser(); if ( ( $user->guest == 0 ) && ( JString::strlen( $this->params->get( 'trailingTextForGuests', '' ) ) > 1 ) ) { if (( $user->guest == 1 ) && ( JString::strlen( $this->params->get( 'trailingTextForGuests', '' ) ) > 0 )) { $makeImageLinkToArticle = false; } } } if ( $makeImageLinkToArticle ) { $firstImageHtml .= '<a href="index.php?option=com_content&view=article&id='.$row->id.'">'; } $attributes = self::_GetImageAttributes( $row->title ); $firstImageHtml .= '<img src="' . $imageUrl. '"' . $attributes . '/>'; if ( $makeImageLinkToArticle ) { $firstImageHtml .= '</a>'; } /* Remove the code for the image on the old location. */ $start = JString::strpos( $row->text, $imageCode ); $row->text = JString::substr_replace( $row->text, '', $start, JString::strlen( $imageCode ) ); } else { /* No image was found. There is no image to move in front of the article. * Nothing to do. */ } } else { /* Don't hunt for an image, don't move it first in the article. * Nothing to do. */ } return $firstImageHtml; } I've got the results what I want, but they aren't completely. I've got problems with URLs. So, is any solution for this code? Can I make to all users can see the articles, not only registered ? With my changes I've got the solution, but I still have problem with URLs. Some solution please ?? Quote Link to comment Share on other sites More sharing options...
gangboy23 Posted November 8, 2010 Author Share Posted November 8, 2010 can anybody help me ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.