WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • Change media image folder name
  • Print
Pages: [1]   Go Down

Author Topic: Change media image folder name  (Read 6820 times)

Offline sky writer

  • Posts: 926
Change media image folder name
« on: October 14, 2015, 09:29:14 PM »
How difficult is it to change the media/bakery image folder to something else, like media/products?
Logged

freeSbee

  • Guest
Re: Change media image folder name
« Reply #1 on: October 14, 2015, 09:57:51 PM »
Hi sky writer

You can use your favorite IDE to perform a search / replace on all Bakery files. The path is hard coded about 33 times. Search …
Code: [Select]
MEDIA_DIRECTORY.'/bakery
and replace by …
Code: [Select]
MEDIA_DIRECTORY.'/products
The main drawback of changing hard coded directory names is that you will have to redo it each time you upgrade.

Regards Christoph
Logged

Offline sky writer

  • Posts: 926
Re: Change media image folder name
« Reply #2 on: October 14, 2015, 10:21:10 PM »
Thank you Christoph.
Logged

Offline jacobi22

  • Betatester
  • **
  • Posts: 5920
Re: Change media image folder name
« Reply #3 on: October 14, 2015, 10:53:58 PM »
is it not a better solution, if you define the gallery folder name in the file modules/bakery/config.php maybe with

Code: [Select]
<?php for colored code only, dont copy that line
// name of the bakery picture folder in media
$sBakeryImgFolder = 'products';  //no leading/trailing slash or backslash!! A simple directory name only!!  
                       

and change

Code: [Select]
MEDIA_DIRECTORY.'/bakery/
to

Code: [Select]
MEDIA_DIRECTORY.'/'.$sBakeryImgFolder.'/
??
Logged

Offline sky writer

  • Posts: 926
Re: Change media image folder name
« Reply #4 on: October 15, 2015, 06:50:23 PM »
Jacobi,

I tried your idea, because I like the thought of being able to change this folder more easily.  But the variable doesn't load in the admin (modify.php) or on the main products overview frontend page (maybe elsewhere, but I noticed these two for sure).

I took off your trailing forwardslash, because that caused the search and replace to miss some files.

replace:
Code: [Select]
MEDIA_DIRECTORY.'/bakery
with:
Code: [Select]
MEDIA_DIRECTORY.'/'.$sBakeryImgFolder.'
Logged

Offline jacobi22

  • Betatester
  • **
  • Posts: 5920
Re: Change media image folder name
« Reply #5 on: October 15, 2015, 10:24:40 PM »
Quote from: sky writer on October 15, 2015, 06:50:23 PM
I took off your trailing forwardslash, because that caused the search and replace to miss some files.

i test only some pages in the backend, but not all functions.  :oops:
Do you have a working solution on this basis now?

P.S.: i think, a good example must be be OneForAll-Module (if i remember correct, it have a way like this in the code)
Logged

Offline sky writer

  • Posts: 926
Re: Change media image folder name
« Reply #6 on: October 16, 2015, 02:47:02 AM »
Hi Jacobi,

I used Christoph's fix, because it works as is.  And since future upgrades will require a new search and replace with either approach, maybe this is the most sensible solution.  At least until the future possibility of something similar being implemented into the bakery core.

But I didn't given up on your idea, because I think it would be a helpful addition.

Here's what I did to get it working.

added your code to the bottom of the bakery/config.php file:
Code: [Select]
// name of the bakery image folder in media
$sBakeryImgFolder = 'products';  //no leading/trailing slash or backslash!! A simple directory name only!! 

Renamed my media/bakery folder to media/products

Did a search (Find in Files) with Notepad++ for all instances of (31 total in 8 files):
Code: [Select]
MEDIA_DIRECTORY.'/bakeryand replaced with:
Code: [Select]
MEDIA_DIRECTORY.'/'.$sBakeryImgFolder.'
There are two files which require different replace formatting
'save_item.php' ~line 278
Code: [Select]
MEDIA_DIRECTORY.'/'.$sBakeryImgFolder.notice the difference, there is no single quote between MEDIA_DIRECTORY.'/'.$sBakeryImgFolder.   <and>   $directory;

uninstall.php ~line 52
Code: [Select]
MEDIA_DIRECTORY.'/'.$sBakeryImgFoldernotice the difference, there is no trailing single quote or concatenation.

I took a look at the OneForAll module files and the calls are to the info.php for the module name '$mod_name' - to complete the media folder path.

There are two files which aren't displaying the images in bakery with the above settings in place, modify.php and view_overview.php

I added the following to those two files (near the top, although I do not know if placement matters), and it now everything seems to work:
Code: [Select]
// Get some default values
require_once(WB_PATH.'/modules/bakery/config.php');

But I do not know enough to know if this is all something that should be done, or what effect it might have.  But it was fun working it out.
Logged

Offline jacobi22

  • Betatester
  • **
  • Posts: 5920
Re: Change media image folder name
« Reply #7 on: October 16, 2015, 02:58:36 AM »
 (Y) (Y) (Y)

Thanks!!

i'll do the same over the weekend
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • Change media image folder name
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2