test
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • rdcooter Friend
    #125900

    I am attempting to use the JA_NewsLight module in the Barite template and I am having problems getting the images to appear as well as the IntroText.

    I have tracked down a couple of the problems but 2 of them are beyond my newbie ability to solve and I need help from somebody with more experience in PHP.

    I was however able to find a bug in the ../ja_newslight/common.php The “switch” statement in the jaResize function has a misplaced closing curly bracket. Where it is now causes all of the code to prepare the destination image and the actual copy to be treated as a part of the default of the switch statement. Effectively never getting executed.

    The other problems deal with the preg_match() & preg_replace() in the replaceImage function. They both have problems with the pattern parameter used in this function.

    The HTML Source for my article appears as follows:
    <p><img class=”caption” title=”Frog Flinger” alt=”Frog Flinger” align=”right” border=”0″ src=”/images/stories/Games/frogflinger_tn.gif” />These fearsome frogs are trying to get to the other side without being a meal for the gators. Using the catapult you have to fling the frogs onto the lily pad to make them safe. See how many you can help on their way across.<br />
    *</p>

    The preg_match() function below essentially cannot get beyond the “class” attribute in the img tag in order to find the “src”.
    [PHP]$regex = “/<imgs*srcs*=s*”([^”]*)”[^>]*>/”;
    preg_match ($regex, $row->introtext, $matches);[/PHP]

    The preg_replace() function below seems to get wildcard happy and keeps searching the string until it finds the last matching pattern in the break tag. This wipes out all of my text and I do not know how to make the preg_replace() stop at the first “/>” that it finds.
    [PHP]$regex1 = “/<img.*/>/”;
    $row->introtext = preg_replace( $regex1, ”, $row->introtext);[/PHP]

    Somebody please help me… I have done a good share I just need a little help to get over the top!

    Menalto Friend
    #240870

    Im passing this over to the creator of the module.

Viewing 2 posts - 1 through 2 (of 2 total)

This topic contains 2 replies, has 2 voices, and was last updated by  Menalto 16 years, 10 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum