Author Topic: function list_template_files possible enhancement / issue fix  (Read 1092 times)


  • Beginner
  • *
  • Posts: 20

I came across a minor issue when I put backups of files in the templates/product_details folder e.g. flypage_images.tlp.php.bak

as the backup files were selectable by backend users in the category information screen. as they appeared in the Category Flypage: drop down menu (less the .bak extension)

I could just delete by backup or move it elsewhere, but a more robust chage would be for list_template_files to only return a list of php files.

Hence I've changed my copy of ps_html.php so that the first 3 lines of list_template_files now read

Code: [Select]
function list_template_files( $name, $section='browse', $preselected='' ) {

$files = vmReadDirectory( VM_THEMEPATH . "templates/$section/",".php$" );

I'm not a regex expert but I think that php$ means strings ending with php

and the fix seems to work fine for me.

i.e it now only builds a list of files that end with php, and my backup files don't appear in the user's list.

BTW. I'm a VM novice, so there could well be other places that should use the .php filter as well to lessen the chances of bugs ;-)