Forums / Developer / New Extension for managing banners based on nodes

New Extension for managing banners based on nodes

Author Message

Bernhard Reiter

Monday 09 May 2005 11:12:20 am

Hi,

I just uploaded a new contribution and wanted to spend a few words on it.

Its general purpose is to manage images and the like (for example banners) based on node trees.
So you upload and assign an image to a node tree, and then through a template function you can get the file assigned to the current node, for example.

It has views for uploading images, managing assignments (adding, removing) and deleting images again (together with all its active assignments).

The basic algorithm behind it is, that it gets passed an node id, then walks from this node up the tree until it finds a node with an image assigned to it, and uses this image for itself.

Its licensed under the GPL.

Tell me your thoughts!

http://ez.no/community/contribs/applications/assign_banners_to_sections

Tim Dickinson

Monday 09 May 2005 3:57:36 pm

Sounds like it could be really useful in principle.
If sponsors wanted to sponsor only a certain section of your site, or you had different sections of your site under completely independent control.

I haven't tried it yet though (got a few other things to workout first ;))

Cheers

Tim

http://www.AdBalance.com - Ad network news and reviews
http://www.DevPublisher.com - Website publisher guides, tools and news
http://www.AudioMelody.com - Make better music

kracker (the)

Tuesday 10 May 2005 5:59:08 pm

I think...

This is great!

I sent this to a friend of ours, who was basically doing this the hard way before now.

It just made cents as a simple way to simplify his development / maintenance time.

cheers,
//kracker

ATHF : Dummer Dolls

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Bernhard Reiter

Wednesday 25 May 2005 11:00:11 am

Check out the newest release!

There are a lot of improvements and i think it now deserves the beta label.

Stéphane Bullier

Thursday 26 May 2005 6:28:21 am

Hi,

Sorry, but I would like to know if thi extension work with ezpublish V 3.5.2

Stéphane

Bernhard Reiter

Thursday 26 May 2005 7:07:57 am

Yes, it works with all 3.5 versions.
All x.x.* versions just contain bugfixes and no api changes.

I have also made some quick tests with 3.6, so it should also work fine with that one.

Stéphane Bullier

Friday 27 May 2005 1:20:17 am

Hi Bernhard,

Thank for your reply.

I've activated the extension from Admin panel.

But after where I can find the Views:
- banner/upload
- banner/assignments
- banner/images

Cheers.

Stéphane

Bernhard Reiter

Friday 27 May 2005 2:44:20 am

You simply enter the url of your ez install and then you append for example banner/upload to it.

For example:

http://localhost/ez/index.php/siteaccess/banner/upload
or if you have set up vhosts in apache:
http://example.ez.local/banner/upload

Hope this helps

Stéphane Bullier

Friday 27 May 2005 5:37:31 am

Hi,

Thank a lot, Bernhard. I passed to access to Banner Administration.

But, I can't upload new image:a red message tell me

"Impossible to copy file to destination directory"

About the update of the database : I have to use the update.sql file.

Cheers.

Stéphane

Stéphane Bullier

Friday 27 May 2005 6:15:01 am

It is ok. It was a problem of right of access to the level of the file /design/mysite/images/banner After having uploaded the banners and having associated them to a node, how I makes to post the banners?

There is a special template file ?

Stéphane

Bernhard Reiter

Friday 27 May 2005 6:56:55 am

<i>About the update of the database : I have to use the update.sql file.</i>

Yes. And i now realized that it missed an column definition.
You can either download version 0.3.1 with the corrected file, or you apply the alter.sql file to your db.

<i>There is a special template file ?</i>

Take a look at the manual. There you see an example of how to call the template function. Just place that snippet in your template of interest and then the image path and alt text get placed in an array.
I am not sure if mention that in the docs, but you can then output them like this. {$array.img} or {$array.alt}
And if this doesnt work just do {$array|attribute(show)}, then you can see how i named the elements.

Stéphane Bullier

Friday 27 May 2005 8:15:06 am

Hi Bernhard,

Thank for your reply. It's ok about the update of database.

I read your manual .txt.

I copy the line :

{set image=fetch('banner', 'image', hash('node_id', $module_result.node_id))}

And after, I write :

<img src={$array.img|ezdesing} />

Nothing happend.

Stéphane

Bernhard Reiter

Friday 27 May 2005 9:59:03 am

Well you assign the result to the variable called image, but then you write $array ;-). That should of course also be image.

Also you should use let rather than set, but i am not sure if that does matter ;-)

Stéphane Bullier

Monday 30 May 2005 12:55:26 am

Hi Bernhard,

Thank you very much for your help.

I succeeded in posting a banner by section.

Just one more question: if there are several banners by section and that one wants that they post way random. That is possible?

Cheers

Stéphane

Bernhard Reiter

Monday 30 May 2005 9:44:43 am

No that is not possible.

But if it is generally wished i would implement it ;-)

Vitaly Puzrin

Thursday 02 June 2005 7:52:21 am

Very useful addon. Thank you very much. I have one more idea about how to make this system even more flexible.

Sometime, I need to asign not images, but just a HTML text (sometime with embedded images & flash). It whould be nice, if your addon will allow to assign ANY object to node.

How to show assigned object - that's on webmaster choice. It's not difficult to select proper output in template, depending on object type.

Bernhard Reiter

Thursday 02 June 2005 10:55:38 am

Well you can theoratically also already now assign any kind of file to an node (for example flash, audio ...).

I think what you suggest is that one could also assign html snippets which include other files to a node.

Do i understand this right?

If not perhaps you could give a more detailed example.

Vitaly Puzrin

Friday 03 June 2005 6:41:44 am

I mean, that anyone can create it's own class, for it own needs, when complex data required. For example, I need sometime HTML text with images. In my case, I will create "banner" class, which will contain one XML field. Such objects are very convenient to edit with OE.

And the most convenient for my case whould to get in template all assigned objects of ANY type. Now you can get only images (files).

If you will add ability to assign custom EZ objects too, you will take off such limitation.

Bernhard Reiter

Friday 03 June 2005 7:48:42 am

Well, i could add the ability to define different object types.
If you then upload a file you would choose of what type it is. I would then also add an key 'type' to the template variable which would contain the chosen type for the object.
(this implies that you can upload any file type, not just images)

The drawback still would be that you can only add one file per object. (could it be useful to add more than one?)

I cannot promise that it will work together with the online editor.
That would mean that i would need to parse the output. Havn't looked into that yet. (though i am sure i could utilize some ez publish class for this).

The way you describe it sounds almost like one would use ez to create classes and objects, and my extension to just seemply asign them. It would then only need to return the right contentobject.
The only thing i am not comfortable with is that then for example a 'banner' would be a normal content object (which could be called form the browser).

Perhaps the others also have an oppinion.

Vitaly Puzrin

Saturday 04 June 2005 12:44:05 am

My suggection is not to substitute, but to extend your greate contribution. Of cause, is't not convenient to make (and operate) separete classes for simple data (such as images). So, your contrib is very useful, of cause.

I just mean, that banners can be of different types. And it would be nice to have both ways to operate. At my site, I need both "clean files" and HTML sniplets, for example.