Great work! I'm not sure if this is possible, or could be a feature idea:

The ability to define a page title/index in the drop down from within the body - something like:

<!--pagebreak--Introduction-->
<!--pagebreak--Specifications-->
<!--pagebreak--Conclusion-->

Resulting in the page drop downs as:

| Page 1 - Introduction |
| Page 2 - Specifications |
| Page 3 - Conclusion |

As used on many review type sites etc.

Thanks a lot!

Tim

CommentFileSizeAuthor
#9 smart_paging-1146218-9.patch2.91 KBsk33lz
#4 smart_paging.zip29.99 KBmaxiorel

Comments

arpeggio’s picture

Category: support » feature

That would be a nice feature. We will include that on Smart Paging's next major version feature list. Thank you for the suggestion.

Tim Jones Toronto’s picture

Thank you, if you need any help etc let me know.

arpeggio’s picture

Yes. Patches are welcome, if you're available to implement this feature that would be great. Thanks.

maxiorel’s picture

StatusFileSize
new29.99 KB

Hello, I did some changes against the 7.x-1.3. However I'm not able to create a good patch now. If you find it useful, I will be glad, if you can commit.

How it works:
1. in *.module are new lines 731 - 740 which scans the fragmented pages for a first H2 occurrence. This will be used for page title/name.
2. New line at 816 which puts the chapters names to the JavaScript for the pager.
3. New lines at smart_paging-pager.js at 6 and 7 - get the chapters names.
4. Changed the line 36 in smart_paging-pager.js to create pager with chapters names instead of the "Page Nr."

Hope it will help you.

arpeggio’s picture

Status: Active » Needs work

Hi, sorry for the delay. Thank you for contributing code. I have test your version of smart paging (your attachment source code) it returns error:
Notice: Undefined offset: 0 in smart_paging_field_attach_view_alter() (line 734 of C:\xampp\htdocs\sites\all\modules\smart_paging\smart_paging.module).
... and it does not page does not break. The body content is:

<p>test</p>
<!--pagebreak--Introduction-->
test intro...
dean clayton’s picture

Has this feature been added in the latest version?

arpeggio’s picture

Not yet, it still has bug.

dean clayton’s picture

ok not a problem, thanks for the update

sk33lz’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new2.91 KB

I've rolled a patch against the latest 7.x-2.x-dev that works as OP intended.

arpeggio’s picture

Status: Needs review » Needs work

@sk33lz I have reviewed your patch. Your version of this feature is based on <h2>. What if my pagebreak looks like this:

<h2>Drupal Modules</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vitae diam at felis feugiat pellentesque. Phasellus varius purus dui, aliquet euismod est semper ac. </p>
<h2>Drupal Themes</h2>
<p>Etiam convallis tortor sed rutrum aliquet. Proin eleifend orci eget metus venenatis, a iaculis nisl finibus. Pellentesque ac ex aliquet, ornare elit ac, varius nibh. Integer pharetra, purus a iaculis semper, massa sem consequat dui, sed commodo nulla lorem ut nisi. Morbi placerat nisi ac consequat tempus.</p>
<!--pagebreak-->
<h2>Drupal Distribution</h2>
<p>Proin mollis nunc eu metus gravida dapibus. Curabitur tristique a urna eget elementum. Suspendisse sit amet quam erat. Sed eu elit elit. Aliquam commodo sed dui non consequat. Suspendisse in eleifend est. Duis a lobortis est, sit amet semper lorem. Phasellus varius egestas libero in consequat. Mauris sem diam, tincidunt eu massa at, auctor volutpat quam. Duis faucibus blandit congue.</p>

There are 3 <h2>, so the dropdown will be:

| Page 1 - Drupal Modules|
| Page 2 - Drupal Themes|

Where I should expect:

| Page 1 - Drupal Modules|
| Page 2 - Drupal Distribution|

... and not all the users want their titles to dropdown menu be based on <h2>.

The original suggestion seems the safe approach for this feature:

<!--pagebreak--Introduction-->
<!--pagebreak--Specifications-->
<!--pagebreak--Conclusion-->

Resulting in the page drop downs as:

| Page 1 - Introduction |
| Page 2 - Specifications |
| Page 3 - Conclusion |
sk33lz’s picture

You are right, as it's not ideal in some cases, but works for how I have been using it. I'll work on a better solution and will submit a new patch when I have it ready for review. Thanks for taking a look at the patch.