Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RT Ticket #229: loop tag does not honour more=1 for list #33

Open
phinjensen opened this issue Mar 14, 2013 · 7 comments
Open

RT Ticket #229: loop tag does not honour more=1 for list #33

phinjensen opened this issue Mar 14, 2013 · 7 comments
Assignees

Comments

@phinjensen
Copy link

Created: Wed Oct 01 16:11:19 2008
Owner: Stefan Hornburg
Requestors: Phil Smith


Hi All,

[more-list] does not work within the [loop] tag if the data is coming from a list=”……”.

For example :

[loop more=1 ranges=1 list=”1..100” ml=10]

[list]

[loop-code]

[/list]

[more-list]
Results [matches] of [match-count] shown

[more]
[/more-list]

[/loop]

In the above example the more list is displayed, but the links do not work.

As discussed on IRC with Racke, this seems to be a bug in the [loop] tag.

Thanks
Phil.

@phinjensen
Copy link
Author

Date: Tue May 19 19:48:17 2009
Author: Gert van der Spoel


Possible patch attached.

Explanation as far as I understand the code:

  • because of the more list it will do a 'scan'
  • when do_scan is called the subroutine 'perform_search' is done
  • this subroutine create the SearchObject
  • later on the tag_loop_list in Interpolate.pm is being called
  • the SearchObject was not being used, so the subroutine was
    followed until the 'default' process .. here it calls the
    region subroutine and eventually does not have enough data to
    show the correct items
  • by setting
    $opt->{object} = $::Instance->{SearchObject}{''} unless $opt->{object};

it will either make $opt->{object} to be "" and it will skip the
following 'if', or it will set it to the SearchObject ....

Not very heavily tested!

https://gist.github.com/uncleshelby/5163925

@phinjensen
Copy link
Author

Date: Tue May 19 19:54:50 2009
Author: Gert van der Spoel


This fix does not work with 2 [loop] tags with more list on the page.

Back to the drawing board.

@phinjensen
Copy link
Author

Date: Tue May 19 20:08:49 2009
Author: Gert van der Spoel


When you have 2 loop tags on 1 page with a more list, they both get the
same MM (mv_cache_key) value ...

Does this make sense?

@phinjensen
Copy link
Author

Date: Wed May 20 09:33:16 2009
Author: Gert van der Spoel


new patch. current patch will work having 2 loop tags on a page.

NOTES:

  1. It works by checking the 'prefix' .. the 'prefix' makes sure that
    each loop has its own mv_cache_key

  2. Issue with this is that if you click next/prev etc on loop X then it
    will set loop Y back to it's initial state ... It does not keep the
    state of the other loop(s)

https://gist.github.com/uncleshelby/5163951

@phinjensen
Copy link
Author

Date: Wed May 20 11:41:16 2009
Author: Stefan Hornburg


The attached patch works nicely without the need of a different prefix. It is recommended to use an explicit label, though it should work without (untested).

Regards
Racke

https://gist.github.com/uncleshelby/5163974

@phinjensen
Copy link
Author

Date: Wed May 20 13:20:06 2009
Author: Stefan Hornburg


My patch relies of course on the fact that a distinct key is generated for the loop's. Interchange considers the first 100 characters of the body

for the generation of the key, which is not configurable.

@phinjensen
Copy link
Author

Date: Thu May 21 11:39:39 2009
Author: Gert van der Spoel


Attached a new patch which has an update for the key generation, other that it is the same as the 229.patch

The label is prefixed, which should be unique for each loop ...

This allows multiple loop lists on the page, with the only drawback that the other loops are reset to their original value when the links in a more-list of another loop is clicked.

This does not work for loop searches for example (second loop does not display a more list), have not tested the other loop possibilities.

https://gist.github.com/uncleshelby/5163989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants