Advertisement:

Author Topic: Osclass path and url  (Read 371 times)

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Osclass path and url
« on: March 16, 2019, 04:08:21 am »
Hey,
Would you please help me to do this!
I want to change all main (path) and main (URLs) of osclass by hook in functions.php
Like:
ABS_PATH
osc_base_url
osc_lib_path()
osc_base_path()
osc_themes_path()
osc_current_web_theme_url()
osc_current_web_theme_path()
osc_current_web_theme_styles_url()
osc_current_web_theme_js_url()
And etc.
Is it possible? If so please help me!
Thanks,

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2132
  • osclass.work
Re: Osclass path and url
« Reply #1 on: March 16, 2019, 03:06:32 pm »
No, all helpers you listed are (in most cases) derived from predefined constants in config.php and index.php / oc-load.php.
« Last Edit: March 17, 2019, 12:20:56 pm by dev101 »

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: Osclass path and url
« Reply #2 on: March 16, 2019, 08:05:51 pm »
No, all helpers you listed are (in most cases) derived from predefined constants in config.php and index.php.

In index and oc-load just (ABS_PATH) defined. All other starts with osc_ defined in core.
So you say that its not possible to change their values in functions.php by hook?
Is there a way to change all urls and paths in one single file? Because i can change ABS_PATH value in oc_load and also osc_lib_path() and osc_themes_path(), because they use LIB_PATH and THEME_PATH values in oc_load. But i can not change osc_current_web_theme_styles_url() value in oc_load because it uses THEME PATH + css. Thats why im looking for a way to change their value in one single file without editing the core file. Thats why i said functions.php.
You said config.php, is it possible to change their value in config.php?

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2132
  • osclass.work
Re: Osclass path and url
« Reply #3 on: March 16, 2019, 08:18:09 pm »
You can modify THEMES_PATH in oc-load.php.
« Last Edit: March 17, 2019, 12:18:43 pm by dev101 »

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: Osclass path and url
« Reply #4 on: March 16, 2019, 08:44:51 pm »
You can define your own THEMES_PATH in config.php, for example, it will override default core value.

What code should we write for defining the theme path in config.php?

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: Osclass path and url
« Reply #5 on: March 16, 2019, 08:58:33 pm »
.
« Last Edit: March 16, 2019, 09:10:11 pm by Sophia_OS »

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2132
  • osclass.work
Re: Osclass path and url
« Reply #6 on: March 16, 2019, 09:38:14 pm »
Same way it is defined in the core.

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: Osclass path and url
« Reply #7 on: March 17, 2019, 06:14:17 am »
Same way it is defined in the core.

it does not override!

Notice: Constant THEMES_PATH already defined in C:\wamp\www\mysite\config.php on line 22

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2132
  • osclass.work
Re: Osclass path and url
« Reply #8 on: March 17, 2019, 11:55:17 am »
Now I see, that particular constant (and few others) is actually first defined in oc-load.php, and default-constants.php just serves as a fail-safe backup, so you either need to define them in index.php or rewrite in oc-load.php to make it work. If you redefine them in index.php, then notice will be generated again in oc-load.php, so you either need to comment out those lines or remove them.

In the end, the best approach is to simply modify them directly in oc-load.php.
« Last Edit: March 17, 2019, 12:22:03 pm by dev101 »

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: Osclass path and url
« Reply #9 on: March 17, 2019, 07:11:17 pm »
Now I see, that particular constant (and few others) is actually first defined in oc-load.php, and default-constants.php just serves as a fail-safe backup, so you either need to define them in index.php or rewrite in oc-load.php to make it work. If you redefine them in index.php, then notice will be generated again in oc-load.php, so you either need to comment out those lines or remove them.

In the end, the best approach is to simply modify them directly in oc-load.php.

Thank you very much for all help but the whole purpose is to not editing the core files. That's why i decided to put in functions.php by hook. And config.php is also okay.
Is it possible to create a php file in installation root and change all the values of urls and paths without editing the core files?

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2132
  • osclass.work


dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2132
  • osclass.work
Re: Osclass path and url
« Reply #12 on: March 18, 2019, 11:58:49 am »
Maybe in newer version this can be optimized a bit, so that only ABS_PATH is set in index, and rest can be in config. But, that would require updating existing installations config files, which is not probably popular, as we might not know what users already did to customize them. Or keeping fallback in oc-load, and loading config earlier.
« Last Edit: March 18, 2019, 12:16:05 pm by dev101 »

Sophia_OS

  • Sr. Member
  • ****
  • Posts: 408
Re: Osclass path and url
« Reply #13 on: March 19, 2019, 07:52:29 am »
Maybe in newer version this can be optimized a bit, so that only ABS_PATH is set in index, and rest can be in config. But, that would require updating existing installations config files, which is not probably popular, as we might not know what users already did to customize them. Or keeping fallback in oc-load, and loading config earlier.

Yeah, lets wait for the new version! Thanks