Topic: [snippet] DropMenu. Modified for weblinks and regexp on keywords/TV.  (Read 20018 times)

Pages: 1 [2] 3   Go Down

#21: 11-Jul-2006, 09:28 AM

Testers

Soda
Posts: 415

Daddy !

WWW
I think it's a good choice to have only one snippet with lot of parameter, it let the choice to the user. Perhaps the author of the original DropMenu is ok to implement your work.
It's afraid me to have lot of snippets with lot of hacks with lots of versions  Embarrassed

Can you help me for the example use of the keywordRegexp parameter.
I want't discard page keyworded with 'blog', 'news' and allow those with 'site' and 'web' 
MODx Sites & Prestations: http://dp-site.fr   [Last MODx Site]
MODx Repository: [HOME]  [MetaTagsExtra] / Current Dev: [xFDM]

#22: 11-Jul-2006, 09:46 AM

Foundation

rthrash
Posts: 11,353

WWW
DropMenu is currently "under the knife" so to speak and will be  replaced by a much simpler and more flexible version very soon. Feel free to hack it up as you see fit in the interim. Wink
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#23: 11-Jul-2006, 09:56 AM

steph
Posts: 86

WWW
I think it's a good choice to have only one snippet with lot of parameter, it let the choice to the user. Perhaps the author of the original DropMenu is ok to implement your work.
It's afraid me to have lot of snippets with lot of hacks with lots of versions  Embarrassed

Can you help me for the example use of the keywordRegexp parameter.
I want't discard page keyworded with 'blog', 'news' and allow those with 'site' and 'web' 

Here are a couple of examples, which are pretty much a cut-and-paste job from my setup. Obviously change the details of any variables (and snippet name) if they're different in your setup.

The following will only output items which have 'site' or 'web' in a template variable called 'keywords':

[!DropMenuMindspillDotNet? &startDoc=`[*id*]` &levelLimit=`1` &here=`current` &selfAsLink=`true` &showDescription=`true` &showAllInMenu=`true` &useWeblink=`true` &tvRegexpField=`keywords` &tvRegexpString=`(site|web)`!]

The following will only output items which don't have 'blog' or 'news' in a template variable called 'keywords':

[!DropMenuMindspillDotNet? &startDoc=`[*id*]` &levelLimit=`1` &here=`current` &selfAsLink=`true` &showDescription=`true` &showAllInMenu=`true` &useWeblink=`true` &tvRegexpField=`keywords` &tvRegexpString=`(blog|news)` &joinMethod=`not`!]

Bear in mind that because of the way MODx stores template variables in the database (i.e. it doesn't if it's value is blank), you should give the 'keywords' TV a value every time you create a page, even if it's something like '-'.

Hope that helps.

Steph

#24: 11-Jul-2006, 09:58 AM

steph
Posts: 86

WWW
Oh sorry, you were talking about the keywordRegexp parameter. In that case...

The following will only output items which have 'site' or 'web' in the keywords:

[!DropMenuMindspillDotNet? &startDoc=`[*id*]` &levelLimit=`1` &here=`current` &selfAsLink=`true` &showDescription=`true` &showAllInMenu=`true` &useWeblink=`true` &keywordRegexp=`(site|web)`!]

The following will only output items which don't have 'blog' or 'news' in the keywords:

[!DropMenuMindspillDotNet? &startDoc=`[*id*]` &levelLimit=`1` &here=`current` &selfAsLink=`true` &showDescription=`true` &showAllInMenu=`true` &useWeblink=`true` &keywordRegexp=`(blog|news)` &joinMethod=`not`!]

#25: 11-Jul-2006, 10:35 AM

Coding Team

doze
Posts: 4,107

....Boom!

Official MODx people... Should I put this in the repository?
I'm not a official team member, but in my opinion, ALL resources should be in the repository. This is a snippet (even though it needs core hacks to work) and should be added as such. Hacks from some allready made snippet could be added as the "Extras" of that particulary snippet, but dropmenu has not been added to the repository yet. Actually none of the core snippet has been added yet, don't know why.

@modx team
It would be good if the current core distribution of dropmenu would be added to the repository and then all the available hacks of it could be added as extras. I've made a list of some here, don't know are they all there. Also the other core distribution snippets/modules/plugins should be added to the repository too, right?
New MODx wiki! Please help up with documentation efforts! || Old Wiki

"He can have a lollipop any time he wants to. That's what it means to be a programmer."

#26: 11-Jul-2006, 10:46 AM

Foundation

rthrash
Posts: 11,353

WWW
You're exactly correct doze... want to add it? Tongue
MODx is a content managmeent framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Please help us help you when asking for assistance and read the wiki. Searching the forums from the top level helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.

#27: 11-Jul-2006, 11:01 AM

Coding Team

doze
Posts: 4,107

....Boom!

You're exactly correct doze... want to add it? Tongue
Yes, I can add it, I'll do it right away.. or did you mean to add all core distribution resources? I can do that also if needed.

Hmm, if snippet has multiple developers, how to add it? I mean that will the repository parse the authors correctly to search filters if used some known delimiter?
New MODx wiki! Please help up with documentation efforts! || Old Wiki

"He can have a lollipop any time he wants to. That's what it means to be a programmer."

#28: 12-Jul-2006, 02:01 AM

Testers

Soda
Posts: 415

Daddy !

WWW
Thanks thanks for the examples, you could put it with the others in the code, it help a lot.
Users: Don't forget to replace & with &
« Last Edit: 12-Jul-2006, 03:45 AM by Soda »
MODx Sites & Prestations: http://dp-site.fr   [Last MODx Site]
MODx Repository: [HOME]  [MetaTagsExtra] / Current Dev: [xFDM]

#29: 12-Jul-2006, 02:34 AM

Testers

Soda
Posts: 415

Daddy !

WWW
Perhaps put all the files in the same archive, with a description for each:
  • a file with the original plugin
  • a file for each different hacks (one per hacker)
It implies the coders work together or have access to add, remove the files in the repository. Difficult but in my opinion the result is good.
Each user can choose what they want.
A system as sourceforce can be good too. (A new module for MODx ?)
MODx Sites & Prestations: http://dp-site.fr   [Last MODx Site]
MODx Repository: [HOME]  [MetaTagsExtra] / Current Dev: [xFDM]

#30: 12-Jul-2006, 02:43 AM

Coding Team

doze
Posts: 4,107

....Boom!

Perhaps put all the files in the same archive, with a description for each:
....
Yes, I was trying to get the "base" version of DropMenu to the repository so that all these different versions could be added as "extras" like here (scroll down to see the extras). But there is a slight problem preventing me to do this.

I can't add the core distribution snippets to the repository, because the author field and filtering resources by it will be messed up. The repository needs an update where it's possible to define multiple authors and get them from smf database so they will get the correct id's.. But I'll let you know when I (or someone else) have uploaded dropmenu to the repo.. There might be a solution in the interim that we use some "team" user to add these resources, but I'm not too happy with that solution, because it will still mess up the resouce filtering feature.

But stay tuned, I hope this can be solved quickly..
New MODx wiki! Please help up with documentation efforts! || Old Wiki

"He can have a lollipop any time he wants to. That's what it means to be a programmer."

#31: 12-Jul-2006, 03:26 AM

Guest
Hey doze!
If the stuff in the repository is part of the core (default install), than the author could simply be "modx", may be plus the version which first incorporated it. Just to differentiate stuff from the core.
It's useful to see at a glance if a resource is already present as a part of the core or not.
And I think that stuff which requires changes in the core-classes should be handled differently, otherwise it may cause a lot of trabble  Grin
Well, personally, I wouldn't put this type of stuff into the repo at all.

just my $0.02

#32: 12-Jul-2006, 03:35 AM

steph
Posts: 86

WWW
You could allow people to post links to the forums from the repos. That way you get the best of both worlds - a nicely organised repository of code which references modifications (along with the discussions that are so often essential to their use). As for things like whether core mods are required or not, I think a simple labelling scheme will suffice (i.e. a few different icons) and perhaps also a difficulty level.

Btw, I've been wondering, why would you want to write &amp instead of & unless you need to validate the code against xhtml or similar? Since snippet code never shows up in the front end why would this matter?

#33: 12-Jul-2006, 03:47 AM

Testers

Soda
Posts: 415

Daddy !

WWW
Sorry, I remove.  Undecided
MODx Sites & Prestations: http://dp-site.fr   [Last MODx Site]
MODx Repository: [HOME]  [MetaTagsExtra] / Current Dev: [xFDM]

#34: 1-Dec-2006, 09:47 AM

spoetnik
Posts: 28

I am trying to use this modified snippet to build a menu with items based on TV's. To bad the core hack doesn't work, because the file to replace is not include in the latest 0.95 release candidate.

I only need to filter my menu items based on a selection of items from 1 TV. Could someone please guide me in the right direction??

Thanks in advance.

#35: 1-Dec-2006, 10:12 AM

steph
Posts: 86

WWW
I'll have a look, but I'll need to check out 0.9.5 first.

This will require a few things, which you could possibly do if you don't want to wait for me:

1. Figure out what the 0.9.5 equivalent to mutate_content.dynamic.action.php.
2. Download my modified version of mutate_content.dynamic.action.php from http://modxcms.com/forums/index.php/topic,2612.0.html
3. Do a diff with the version packaged with modx 0.9.2 to see what I changed (the changes are basic and few).
4. Apply the same changes to the file identified in step 1.

#36: 5-Dec-2006, 09:21 AM

spoetnik
Posts: 28

Hey Steph,

Thankls in advance for looking into it.
When i read the topic where you mention teh core-hack, i understand that the hacks are just minor, and only to support Keywords for weblinks?
For my need, it would be O.K to just be able to filter menu itmes for their T.V. To bad this gives me a error about a Missing argument for makemap().
Could you please point me in the right direction??

Thanks,

Martijn

#37: 5-Dec-2006, 01:53 PM

steph
Posts: 86

WWW
Here's the modified core code for MODx-095rc3-rev2066 along with the original so you can do a comparison to see what's changed.

mutate_content.dynamic.php is the new one.
mutate_content.dynamic.php.orig is the original.

It goes in manager/actions/.

Not sure about your problem with the makemap function, because that's a function in the modified DropMenu snippet, and one that that Soda previously had before I updated the snippet (see earlier in this topic). Do you have the latest version? If you do, please post it so that I can compare it to mine.

* mutate_content.dynamic.php.zip (22.86 KB - downloaded 241 times.)

#38: 5-Dec-2006, 02:25 PM

Coding Team
heliotrope
Posts: 2,535

WWW
Hi steph,

Does your changes to mutate_content.dynamic.php  allow to choose any template for weblinks and so attach TV to them ?

:-)

#39: 5-Dec-2006, 02:59 PM

steph
Posts: 86

WWW
In short, yes.

I simply applied the changes that I'd made to mutate_content.dynamic.action.php from v 0.9.1. The changes, as detailed here http://modxcms.com/forums/index.php/topic,2612.0.html, are as follows:

a) Modified some conditions to allow the META Keywords tab and the TVs to show for weblinks in the manager.
b) Removed an html hidden field that prevented weblinks being associated with a template.

These changes were needed so that weblinks can have META Keywords and template variables associated with them, which is necessary to do the regexp search.

I also changed the description field into a textarea, since this allows you to add more content, but this has nothing to do with the modified DropMenu.

#40: 19-Jan-2008, 06:12 AM

Marschant
Posts: 133

Hi I'm trying to get this snippet to work in 0.9.6.1 It does not work if I pass the following parameters: &tvRegexpField=`devStatus` &tvRegexpString=`(current)`

devStatus is defined as as drop down list menu: Current Development==current||Past Development==past

I'm in desperate need of help here, if you can't help perhaps you could explain how I would generate a comma seperated string of doc id's that match the tv value so I can use wayfinder instead...

Thank you in advance.
Pages: 1 [2] 3   Go Up
0 Members and 1 Guest are viewing this topic.