fileparse.php

The fileparse.php reference is a script which acquires the file path of a resource on the Solodev file system for use on the frontend of your site. Generally used in relation to images that are stored in the "web files" folder, fileparse.php is used to construct source URLs in "<a>", "<img>", "<script>", and "<link>" tags. 

Overview

When you upload an image (typically via the WYSIWYG editor), Solodev automatically places the image in a "_Assets" folder that is a peer to a specific page as shown below:

 

The source for each image tag then includes a reference to "fileparse.php". For the above screenshot example, this source is "/core/fileparse.php/436/urlt/design.jpg". The reference "fileparse.php" is simply a built-in script that gets the URL of a specific folder ID. In this example, the "_Assets" folder in question has an ID of "436" as shown below:

 

In essence, the fileparse.php script will return the path to the specified folder and then find the asset file name ("design.jpg" in this case).

Use Cases

You can reference the "design.jpg" image elsewhere on your Solodev site simply by specifying the image source as "/core/fileparse.php/436/urlt/design.jpg". Accordingly, you can reference similar assets as long as you (1) know the folder ID the asset exists within and (2) you know the asset name.

Use Outside of the WYSIWYG

There are situations where you will need to upload an image or asset outside of the WYSIWYG editor (such as when creating .tpl files or modules). For these situations, you can (1) create [if necessary] and upload the files directly to a "_Assets" folder using "Add >> File" in the toolbar and (2) use the above fileparse.php method to create the asset's source path. 

0 Comments

Please sign in to leave a comment.
Have more questions? Submit a request