This is a conceptual question rather than a technical one and might seem silly but anyway here goes.
I'm trying to parse a public amazon wishlist given in this link using jsoup. I am able to do that currently.
As you can see in the above link, there are total 9 pages of in that wishlist in the format
1 2 3 4 5 6 7 .. 9
If there were n pages in a public wishlist then will the format be
1 2 3 4 5 6 7.. n
I need to know how all the pages in an Amazon Wishlist are represented so that I can code accordingly.
Links to various public Amazon Wishlists containing 2,5, 10, 20 pages are welcome to help understand how the pages are shown.
There are few options to know how many pages are in the list:
All the links to the other pages are at the same format: http://www.amazon.com/gp/registry/wishlist/3C96S5RO2A5A9/ref=cm_wl_sortbar_v_page_X/182-3573734-9320732?ie=UTF8&page=X (the page number is X and it appears twice in the URL), so you can loop on X from 2 and on. You should get 200 OK response for all the pages, until you hit a non existing one.
Download the first page and do:
Elements e = document.select("#wishlistPagination > span:nth-child(1) > div:nth-child(1)");
String s = e.text();
The string s contains now - ?Previous 1 2 3 4 5 6 7 … 9 Next? so find the number after the ellipsis or before "Next" and you're done.
EDIT
In a second thought - if the list contains 7 pages or less, there won't be "next" in the string, so the first method (fetching all the URLs and changing the page number X) is more robust.
Related
I have a woocommerce store and I want to change the order that star ratings are displayed in the single product page. Now the star rating system is from 1 to 5. I want to display first the 5 and go to 4 - 3 - 2 - 1. Any thoughts?
Thanks
Based on your pastebin , i have edited it so that the ordering becomes 5-4-3-2-1 , check it out if it works properly
`https://pastebin.com/A2gXJnDu`
I have a top profileid and a filtered profileid.
the filtered profileid uses a path starting with /xxx/yyy/
now in site I have 2 view pages -
1) top profile + my filter of /xxx/yyy/
2) sub profile
both pages show the same number and values for pages
but when I do a view of "ga:pageviews, ga:visitors, ga:visits"
I get different values only for visits (sometimes 0 on #1)
examples of output
1)
70 5 1
40 8 0 <--how can I get a zero?
2)
70 5 6
40 8 8
so hitting the top profile and adding my filter to the call gives me invalid visits.
using the same code for profile #2 I get correct numbers.
looking inside google admin, profile 2 only has the 1 filter and it matches the same as what I am doing in code. also the pages match up so this does not make sense to me.
how is it possible to get numbers but have no visits?
is there a way to get an individual listing of the data that it is using to output to my filtered request?
http://www.analyticsedge.com/2014/09/misunderstood-metrics-sessions-pages/
I think I figured this out. doing the filter inside google as a separate profile will retag the first page to a session count, whereas if I query the top profile and filter on my end I will get very low session starts because most people hit the home page or login page which counts as their session start.
it seems I cannot use the metric sessions or visits along with my filtering to a sub section.
This question is in reference to my previous question. Based on my requirements I have made some correction to my database, but I am not still sure how I can create sub-menus (Which need to be created from another table rather than the main pg_Pages table.
I keep Page information in pg_Pages from where I can create my menus. My problem is that I can easily create sub-menus for "About Us" and "Multimedia" since I store those pages in the pg_Pages table, but I need to create sub-menus for News from the News Category table and link them to the proper page Handler. & Issue from magazine table.
Menus Example
Sample Data
pg_Pages Table
PageID PageName LangID PagePositionNo PageURL PageInheritance
1 Home 1 10 Default.aspx 0
2 About Us 1 20 Page.aspx 0
3 PageOne 1 10 Page.aspx 2
4 PageTwo 1 20 Page.aspx 2
5 Multimedia 1 30 Page.aspx 0
6 Video 1 10 Videos.aspx 5
7 PhotoGallery 1 20 Gallery.aspx 5
8 News 1 40 News.aspx 0
9 Issues 1 50 # 0
10 Publication 1 60 Page.aspx 0
11 SpanishHome 2 10 Default.aspx 0
12 SpanisAbout Us 2 20 Page.aspx 0
------------------------------------------------------------------------------
Magazine
MagazineID MagazineIssueCode LangID MagazineTitle MagazineLiveIssue(CurrentIssue)
1 101 1 Mag Title 0
2 102 1 Mag Title 1
3 101 2 SpanisgMag Title 0
4 102 2 Mag Title 1
------------------------------------------------------------------------------
art_Article Table
ArticleID ArticleTitle ArticleCatID MagazineID Language TYPE
1 Article one 100 1 1 Artile
2 Article two 100 1 1 Artile
3 Article three 200 1 1 Artile
4 Article four 300 1 1 Artile
5 Article Five 100 2 1 Artile
6 EditorMessage 300 2 1 EditorMessage
7 Article seven 200 2 2 Somthing
------------------------------------------------------------------------------
I want my design to be flexible enough to read menus from different tables. What approach/changes should I take/do to get it done properly rather than creating a separate table for all the Menus & link them to pages? Please suggest the best approach for this scenario.
I want system to be very flexible and read menu information directly from the database rather than creating static links and firing queries based on IssueID or some other ID.
News Menu basically show categories of article, Further i need a query which will only show categories under News menu which has articles for that particular issue. Suppose if issue 102 doesnt have any article related to Culture then Culture sub-menu should not show up under news.
For a generic CMS there should be a separate Menus table and a related MenuItems table.
There can be different kinds of menus - top/main menu, inner left menu, site footer etc... you should define them in the menus table.
Than you should have a recursive MenuItems table which can have an infinite number of sub-menu items.
Menus table should at least have these columns:
MenuID (int)
Description (nvarchar(...))
CreateDate, CreatedBy, ModifyDate.... - Logging columns...
MenuItems table should have at least these columns:
MenuItemID (int)
MenuID (int) - Related to which menu???
Caption (nvarchar(...))
LanguageID (int or whatever)
ParentMenuItemID (int) for recursion
Link (nvarchar(...)) whatever it is linking to (page, outer site, nothing,...). At the end everything has to come down to a link...
IsExternalLink (usually for external links you might disable S.E.O. crawling and open on another tab - So knowing it might be good)
SortOrder (int) the ordering
CreateDate, CreatedBy, ModifyDate.... - Logging columns...
Hope it helps...
Your task is to map your site instances onto menu instances. This can be easily done with View.
So, for example, create viewMenu with the following columns: MenuItemId, MenuItemName, MenuItemLevel, MenuItemParent, MenuItemUrl. You can manipulate these properties to create your menu in your code. Also you can manipulate data from your current database structure or any future structure using SQL query creating initial view.
As for now, you may union results of three different queries to your three tables. In the future you can add functionality to your menu changing view. As well as add new items to your menu when adding new tables to your database.
I'm looking for a simple pager to add to a View where I give it the current page number and the total number of pages, and it generates something like this:
< Prev 1 2 [3] 4 ... 28 Next>
Unfortunately everything I find uses a PagedList of enumerable items or is built around a data list. In my case, I just have a multi-page report where I want to navigate from page-to-page.
Any suggestions?
With CCK, I've added a field to the basic "Page" node type called "Resource Type". There are four possible resource types to choose from, in a dropdown, "Training, News, Research, Tools".
I've created a view that should group the nodes by their resource type. I've created 8 nodes, 6 of which are of type "Training", 1 is of type "Tools" and 1 is of type "News". Drupal is outputting the following:
Training
- Training Node 1
- News Node 1
- Tools Node 1
- Training Node 2
- Training Node 3
Tools
- Training Node 4
News
- Training Node 5
Research
- Training Node 6
When I tested with only 1 node per resource type, it displays as expected:
Training
- Training Node 1
Tools
- Tools Node 1
News
- News Node 1
I saw the other posting where the Devel module can screw up the output, but I'm seeing the above while the user is logged out (and therefore Devel is disabled for anonymous users).
Any idea what could be going wrong? My view is set to be an "HTML List", grouped by "Resource Type".
Not 100% sure, given that I do not have your setup to make tests, but it looks like you are experiencing this issue. On comment #16 Merlin of Chaos (the author of views) provides a patch that subsequent comments seem to confirm as "working".
If that is not the case, a workaround could be for you to sort nodes instead of grouping them. You could add the grouping header by passing to the template also the node type value: you then would add the header with the type of content by comparing with the previous one. In pseudo-code:
$type_in_use = 'xxx'
if $type_of_next_node != $type_in_use then
$type_in_use = $type_of_next_node
print_header($type_in_use)
Just an inelegant workaround, but should work!
HTH