Jump to content

Efficient Way of Working with XML File


nz_mitch

Recommended Posts

Hi there,

 

We're using SlideShowPro Director and the SSPD Connector for WordPress to pull galleries from Director into WordPress pages using the SSPD API. Anyhow, everything's working really well except the solution we came up with does not seem to have scaled well.

 

The code we're using is the following (it's hooked into the WordPress template):

 

				$slideshow = get_post_meta($post->ID, 'slideshow', TRUE);
				$xml = simplexml_load_file("http://domain.com/wp-content/plugins/slidepress/tools/param.php?gid=$slideshow");
				$url = $xml->nativeParams->attributes()->xmlFilePath;
				$id = ereg_replace('[^0-9]',"",$url);

				sspdc_photostrip($id,20);

 

Essentially what the code does is it grabs the slideshow ID from a custom field in WordPress, then uses it to fetch the XML configuration file created by SlidePress (this file contains a number of variables, one of which is the ID for the Slideshow in SlideShowPro Director).

 

The variable $url fetches the full URL to the slideshow in director (it too is an XML file).

 

Next, with $id I'm using ereg_replace to strip everything from the URL except for the digits which make up the ID number which is required for the final function to call the gallery.

 

Finally, the function sspdc_photostrip($id,20); builds the gallery, using $id to fetch the right gallery.

 

If I comment out $slideshow, $xml $url and $id and insert the gallery number manually, the gallery builds super fast. If I just call $slideshow and parse that through the function, the gallery obvious does not load as the ID isn't recognised—but everything happens quickly, suggesting that the WordPress part is fine.

 

Essentially, it looks like the issue is in the loading and parsing of the XML file (commenting out $id doesn't seem to make a difference).

 

Can anyone recommend a more efficient way of doing this?

 

As usual I'm at a bit of a loss—any help would be hugely appreciated. If there's any other information that might help, please let me know!

 

Thanks in advance! :)

Link to comment
Share on other sites

I've been trying to figure out if there's a more efficient method to get the data out of the XML file (as I'm guessing that's where the slow down is) but haven't been able to make anything work.

 

For reference, here's the XML file:

 

−
<params>
<customParams sspWidth="635" sspHeight="428" navButtonStyle="Default"/>
<nativeParams albumBackgroundAlpha="0" albumBackgroundColor="0x262626" albumDescColor="0xCCCCCC" albumDescSize="9" albumPadding="8" albumPreviewScale="Crop to Fit" albumPreviewSize="54,40" albumPreviewStrokeColor="0xFFFFFF" albumPreviewStrokeWeight="0" albumPreviewStyle="Inline Left" albumRolloverColor="0x262626" albumStrokeAppearance="Hidden" albumStrokeColor="0x141414" albumTextAlignment="Center" albumTitleColor="0xFFFFFF" albumTitleSize="10" audioAutoStart="Off" audioLoop="Off" audioPause="Off" audioVolume=".8" autoFinishMode="Switch" cacheContent="None" captionAppearance="Overlay Auto (If Available)" captionBackgroundAlpha=".75" captionBackgroundColor="0x000000" captionElements="Header and Caption" captionHeaderBackgroundAlpha=".8" captionPadding="5,5,5,5" captionPosition="Top" captionTextAlignment="Left" captionTextColor="0xEEEEEE" captionTextSize="9" contentAlign="Center" contentAreaAction="Launch Hyperlink" contentAreaBackgroundAlpha="0" contentAreaBackgroundColor="0x171622" contentAreaInteractivity="Action Area Only" contentAreaStrokeAppearance="Hidden" contentAreaStrokeColor="0x262626" contentFrameAlpha="1" contentFrameColor="0x262626" contentFramePadding="0" contentFrameStrokeAppearance="Hidden" contentFrameStrokeColor="0x333333" contentOrder="Sequential" contentScale="Crop to Fit All" contentScalePercent="1" directorLargePublishing="On" directorLargeQuality="80" directorLargeSharpening="1" directorThumbQuality="60" directorThumbSharpening="1" displayMode="Auto" feedbackBackgroundAlpha=".4" feedbackBackgroundColor="0x000000" feedbackHighlightAlpha=".8" feedbackHighlightColor="0xFFFFFF" feedbackPreloaderAlign="Center" feedbackPreloaderAppearance="Pie" feedbackPreloaderPosition="Inside Content Area" feedbackPreloaderTextSize="12" feedbackScale="1" feedbackTimerAlign="Top Right" feedbackTimerAppearance="Visible" feedbackTimerPosition="Inside Content Area" fullScreenReformat="On" fullScreenTakeOver="On" galleryAppearance="Visible" galleryBackgroundAlpha="0" galleryBackgroundColor="0x1c1c1c" galleryColumns="2" galleryOrder="Left to Right" galleryPadding="10" galleryRows="4" galleryNavActiveColor="0x303030" galleryNavAppearance="Hidden" galleryNavInactiveColor="0x000000" galleryNavRolloverColor="0x262626" galleryNavStrokeAppearance="Hidden" galleryNavStrokeColor="0x141414" galleryNavTextColor="0xCCCCCC" galleryNavTextSize="9" keyboardControl="On" mediaPlayerAppearance="Hidden" mediaPlayerBackgroundAlpha=".25" mediaPlayerBackgroundColor="0x000000" mediaPlayerBufferColor="0x000000" mediaPlayerControlColor="0xFFFFFF" mediaPlayerElapsedBackgroundColor="0xFFFFFF" mediaPlayerElapsedTextColor="0x000000" mediaPlayerPosition="Bottom" mediaPlayerProgressColor="0xCCCCCC" mediaPlayerScale=".8" mediaPlayerTextColor="0xEEEEEE" mediaPlayerTextSize="9" mediaPlayerVolumeBackgroundColor="0x000000" mediaPlayerVolumeHighlightColor="0xCCCCCC" navAppearance="Hidden" navBackgroundAlpha="1" navBackgroundColor="0x121212" navButtonsAppearance="All Visible" navButtonColor="0xEEEEEE" navGradientAlpha=".3" navGradientAppearance="Glass Dark" navLinkAppearance="Thumbnails" navLinkCurrentColor="0xEEEEEE" navLinkPreviewAppearance="Hidden" navLinkPreviewBackgroundAlpha="1" navLinkPreviewBackgroundColor="0xFFFFFF" navLinkPreviewScale="Proportional" navLinkPreviewSize="80,60" navLinkPreviewStrokeWeight="1" navLinkRolloverColor="0xFFFFFF" navLinkSpacing="10" navLinksBackgroundAlpha="1" navLinksBackgroundColor="0x121212" navNumberLinkColor="0x999999" navNumberLinkSize="9" navPosition="Bottom" navThumbLinkBackgroundColor="0x666666" navThumbLinkInactiveAlpha="1" navThumbLinkShadowAlpha=".6" navThumbLinkSize="20,20" navThumbLinkStrokeWeight="1" permalinks="Off" smoothing="Off" startup="Load Album" textStrings="Previous Screen,Next Screen,Screen,of,No caption,No title,Playing,Paused,Click play to start audio" toolAppearanceContentArea="Hidden" toolAppearanceNav="Visible" toolColor="0x222222" toolTextColor="0xEEEEEE" toolTextSize="9" toolDelayContentArea="0" toolDelayNav=".5" toolTimeoutContentArea="0" toolLabels="Gallery,Previous Group,Previous,Next,Next Group,Pause,Play,Full Screen,Normal Screen,Open Link" transitionDirection="Left to Right" transitionLength="2" transitionPause="4" transitionStyle="Blur" typeface="Lucida Grande,Lucida Sans Unicode,Verdana,Arial,_sans" typefaceHead="Lucida Grande,Lucida Sans Unicode,Verdana,Arial,_sans" typefaceEmbed="Off" videoAutoStart="On" videoBufferTime="5" xmlFilePath="http://domain.com/ssp-director/images.php?album=54" xmlFileType="Director"/>
</params>

 

You'll see it's the number "54" right at the end of the the XML file I'm after..

Link to comment
Share on other sites

  • 4 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.