[prev in list] [next in list] [prev in thread] [next in thread] 

List:       midgard-dev
Subject:    [midgard-dev] mgd_list_pages_by_style
From:       Alan Knowles <alan_k () hklc ! com>
Date:       2001-02-28 4:10:42
[Download RAW message or body]


Ok, one of the last 3 bugs we have left is 'image' replacement.

eg. A user uploads their web page (edited with dreamweaver or whatever) and it
has lots of images in it, they can upload the images to the system after doing
the page..

now previously nadmin used /attachment/3/find/style/5/xxx.gif - this meant
that replacing all the urls for images was a simple search and replace 
/image -> /attachment/3/find/style/5/

however since we have move to GUID based attachments the paths are now
/attachment/203480sd0f982039485/2034802384asdf/xxx.gif
where the second GUID is the blob's guid. - This in theory is alot faster, as
it does not have to do a list->attachments and match them for every image..

however it made our web designers job a nightmare, when they loaded up a new
page with images, they had to go through and replace all the images
individually.

To alieviate this rather serious issue, we decided to modify our upload script
to do a search and replacement on the html to find the image links and correct
them for the user.....

now we discovered that the users where using style images in page content and
when they made a modification - eg. deleted an existing image, then uploaded a
new one with the same name, - they expected it to work. as users do :)

to fix this we had to change the replacement to look for all pages using this
style and replace /attachment[^ ]/imagename within them.  

now the only way to find a page using a style is to either walk then get (very
slow), or list_page recursively (faster) - on a large site however, this could
take quite a while..

So this is the additional function in page.c that we added ??? can this make
it into 1.4.1?????



MGD_FUNCTION(list_pages_by_style)
{
    
    zval **style;
  

    RETVAL_FALSE;
    CHECK_MGD;
    if (ZEND_NUM_ARGS() != 1
	|| zend_get_parameters_ex(1, &style) != SUCCESS)
	WRONG_PARAM_COUNT;
    convert_to_long_ex(style);

	
    php_midgard_select(&MidgardPage, return_value, "page.id AS
id,name,style,title,changed,author,"
	       NAME_FIELD " AS authorname", "page,person",
	       "person.id=page.author AND style=$d", "name",
(*style)->value.str.val);
}





in mgd_page.h
extern MGD_FUNCTION(list_pages_by_style);

in midgard.c
MGD_FE(list_pages_by_style, NULL)









-- 
Technical Director
Linux Center (HK) Ltd.
www.hklc.com



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@midgard-project.org
For additional commands, e-mail: dev-help@midgard-project.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic