Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
find_file for view helper
It's a necessary function for using in layouts(including css, js, img files)
I'm not found correct path to acces from template to this function.
  • Loading branch information
Alexandr committed Apr 6, 2014
1 parent 37374af commit 76bf1a1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions classes/PHPixie/View/Helper.php
Expand Up @@ -48,6 +48,23 @@ public function get_aliases() {
return $aliases;
}

/**
* Finds full path to a specified file in the /assets folders.
* It will search in the application folder first, then in all enabled modules
* and then the /assets folder of the framework.
*
* @param string $subfolder Subfolder to search in e.g. 'classes' or 'views'
* @param string $name Name of the file without extension
* @param string $extension File extension
* @param boolean $return_all If 'true' returns all mathced files as array,
* otherwise returns the first file found
* @return mixed Full path to the file or False if it is not found
*/
public function find_file($subfolder, $name, $extension = 'php', $return_all = false)
{
$this->pixie->find_file($subfolder, $name, $extension, $return_all);
}

/**
* Escapes string to safely display HTML entities
* like < > & without breaking layout and prevent XSS attacks.
Expand Down

5 comments on commit 76bf1a1

@Kalzem
Copy link
Contributor

@Kalzem Kalzem commented on 76bf1a1 Apr 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSS, JS, IMG files shouldn't be in the App folder nor assets folder but in web folder.

@dracony
Copy link
Owner

@dracony dracony commented on 76bf1a1 Apr 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True actually. Strange how this didn't occur to me. It wouldn't even be possible to link to files in assets folder (since they are not publicly accesible).

I don't think I should revert it right now, since it doesn't break anything. But how would you use it @Darkspringreen ? Perhaps it's not really needed at all?

@Kalzem
Copy link
Contributor

@Kalzem Kalzem commented on 76bf1a1 Apr 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not trying to be mean, but if there is no "real" use, there shouldn't be any reason to load the framework. I would like to see @Darkspringreen 's life example of this function.

@dracony
Copy link
Owner

@dracony dracony commented on 76bf1a1 Apr 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.
Lets wait for his reply for a day or so and if none I'll revert the merge.

@dracony
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright =) I'll remove it then =)

Please sign in to comment.