•  » Engine
  •  » [development] Help to understand Piwigo const and path access

#1 2012-05-10 16:47:24

psli
Member
2012-04-27
18

[development] Help to understand Piwigo const and path access

Hello,

I'm new to piwigo development (and PHP as well...) .

I've started mysite & month ago and needed possibility to geotagg my categories (not my pictures).
After trying rvgmaps plugin (awesome) I thought of creating one with bing maps (sorry I'am a Microsoft fanboy) for my specific use.

The work done, it became plugin "Psli-BingMaps" that I release few days ago.

Now, some users who tried my plugin find an annoying bug ...

I coded access to the file in the plugin with relative path starting from PHPWG_PLUGINS_PATH but it seems that in some case when URL is modified like this one :

"http://www.toto.net/galerie/index/category/album"

PHPWG_PLUGINS_PATH could not find file in my plugin (more specifically JS file in a JS subdirectory of my plugin).


I'm sorry for this long post.

Could anyone help me to understand how i can access to files in my plugin from any Piwigo configuration ?

Thank you very much in advance.

psli

Offline

 

#2 2012-05-10 17:00:47

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [development] Help to understand Piwigo const and path access

here is what I use (for Crypto Captcha here)

in the php file :

Code:

define('CRYPTO_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
$template->assign('CRYPTO_PATH', CRYPTO_PATH);

in the tpl file :

Code:

{combine_css path=$CRYPTO_PATH|@cat:"template/colorpicker/colorpicker.css"}
{combine_script id="jquery.colorpicker" require="jquery" path=$CRYPTO_PATH|@cat:"template/colorpicker/colorpicker.js"}

the constant CRYPTO_PATH contains a relative url to my plugin folder, which works even if the folder is renamed

Last edited by mistic100 (2012-05-10 17:02:49)

Offline

 

#3 2012-05-10 17:07:30

psli
Member
2012-04-27
18

Re: [development] Help to understand Piwigo const and path access

Thank you for your (quick) answer.

If I understand your code, when you want to add js file to your page, you don't insert it with HTML tag (<script></script>) but with this smarty tag combine_script.

And from within PHP (for including file) ? is there any standard solution to access file or does "PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'" will work in any case (even with right management on the server) ?

psli

Offline

 

#4 2012-05-10 17:10:46

psli
Member
2012-04-27
18

Re: [development] Help to understand Piwigo const and path access

As I read again your answer, i'm not sure if my problem will be solved ?

I add "<script>" in a prefilter, so it seems at the time where my code is processed all smarty tags have already been translate ... If i add "{combine_script " will it be translated  ?

Offline

 

#5 2012-05-10 17:19:03

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [development] Help to understand Piwigo const and path access

yes, you can use smarty tags in prefilters

for php includes in use with my previous code
include(CRYPTO_PATH.'my_file_to_include.php');

Offline

 

#6 2012-05-10 17:43:06

flop25
Piwigo Team
2006-07-06
7038

Re: [development] Help to understand Piwigo const and path access


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 
  •  » Engine
  •  » [development] Help to understand Piwigo const and path access

Board footer

Powered by FluxBB

github linkedin newsletter Piwigo.org © 2002-2026 · Contact