How to go back multiple pages in ionic 3 - ionic2

I have the page flow like below:
A->B->C->D
Somehow I will do a function in page"D", after it need to go back page"B".
How can I achieve that?
Using .pop() just can go back one page.
Using .push(B) is also not the solution, because the flow will become:
A->B->C->D->B
The solution I want is:
A->B
Anyone know how to achieve it? Thanks a lot.

this.navCtrl.popTo(this.navCtrl.getByIndex(this.navCtrl.length()-(N+1)));
Where N is the number of pages that you want to go back.
So if you want to go back 2 pages N=2

Try Using the popTo() method by giving the index of page in a parameter like below:
nav.popTo( this.navCtrl.getByIndex(1))

Related

Use the sheet number to check the active sheet

Before some code runs, I want to check it is the correct sheet.
I can use the sheet name, but my concern is that if someone changes the sheet name, the code won't run. The sheet index also seems to change if the sheet is moved.
Therefore I want to use something that doesn't change.
I believe the sheet number and sheet ID never change.
So I was hoping to use one of them, but I can't see a way of doing that.
What I want in non-coding language is:
If active sheet number = 4 then run the code or
If active sheet ID = 0123456789 then run the code.
Thanks to JPV's link, I have an answer and learned a few things.
You can't use the sheet number to check if the correct sheet is active.
You can use the getSheetId(), but the return you get is not useable.
To make it useable, you need to add getSheetId().toString().
To do the if statement, I needed two equal signs.
if (SpreadsheetApp.getActiveSheet().getSheetId().toString() == 0123456789) {do this when true}
I've been trying to solve this for days, so I should have come here and asked for help earlier.
The main thing I didn't know was the "toString()" part. It always seems so easy and obvious once I know.
Thank you, JPV.
Thanks to JPV's link, I have an answer and learned a few things.
You can't use the sheet number to check if the correct sheet is active.
You can use the getSheetId(), but the return you get is not useable.
To make it useable, you need to add getSheetId().toString().
To do the if statement, I needed two equal signs.
if (SpreadsheetApp.getActiveSheet().getSheetId().toString() == 0123456789) {do this when true}
I've been trying to solve this for days, so I should have come here and asked for help earlier.
The main thing I didn't know was the "toString()" part. It always seems so easy and obvious once I know.
Thank you, JPV.

How to get Facebook Page ID from Page URL

I need to get the Page ID from the Page URL. This is NOT from inside a page tab, that's easy. This is similar to what is being done here: http://findmyfbid.com
Any help would be appreciated as I have been searching for over an hour! Bonus points for showing how to do this in classic ASP. I have no issue getting signed requests & parsing them, the URL to ID portion is what is throwing me.
thanks :)
As noted above in 1st answer commments, that does work, but it's not the data that we want since it's an external url. THIS is the correct way to do it:
https://graph.facebook.com/v2.5/cocacola?access_token=[yourtoken]
OR
This works too:
https://graph.facebook.com/v2.5/https://www.facebook.com/cocacola?access_token=[yourtoken]
This is the way to do it: https://developers.facebook.com/docs/graph-api/reference/v2.0/url
if you are using a GET request, be sure to append access_token=appid|appsecret to the URL you are requesting and it will work.
Thanks for the tip to point me in the correct direction Alex!

Get order value on success page for conversions

I'm setting up some conversion javascript on a BigCartel store.
I'd like to get the order value in a variable, e.g.
var conv_total = "[order value here]";
And I can't find an appropriate variable from BigCartel. Anyone know the proper bit of code here?
Unfortunately there's not a way to modify the success page to include any kind of order details, so adding your own conversion code to include order values isn't possible. Sorry about that!
I had worked on BigCartel earlier and I had noticed there is no particular variable of order total for confirmation page. still if you have some idea about jQuery/javaScript you can customize conversion code to add order value because total amount is appearing on confirmation page. if you need more assistant let me know I can try to sort this issue for you. To contact leave a message on http://www.notesonclick.com

How to implement previous- and next-links in the object-detail-view of a search-result?

I am almost done with my first production-ready django-project. I got one big problem left:
I got an article-search-view that renders a list of found articles. Pagination is working just fine for the resultlist. When I click on the article-title the object-detail-page opens. What I want: previous- and next-result-links on the object-detail-page.
I tried several approaches to similar problems but didn't find a working solution. If I try to use a paginator with only one article (for the object-detail-page) I need to know that paginator-index in the resultlist. But how?
Even the .get_next(previous)_by_foo-Method is not really usable in this scenario AFAICT. Or am I missing something obvious here? Thanks for any help in advance!
Paginator from django works with lists. A way of searching indexes in lists it's like that:
['aaa', 'bbb', 'ccc'].index('bbb') # result: 1
or so like this:
model = object()
[object(), object(), model].index(model) # result: 2
Hope that gives you a hint on how you find paginator-index on your list.
If you want to get a link, at object-details-page, to next item from search-result, you must get next item from the search-result. To get a next item you need to perform the same search query which was executed in search-page and apply some extra filters to get only the next item from that list. But here you have a problem: you only have object-id in object-details page, you don't have the search-term. Without search-term you won't be able to create the search-query. That means you need to get search-term somehow. How do you get that search-term? You need to pass it from the search-result-page somehow. You can save the search-term in session/cookie, or, maybe better: you can pass it via a GET parameter to object-details page. Now when you search-term in object-display page, you can perform a search-query, and from that query you can select the next and the previous objects.
I think now you should be able to implement that. If not you could show some of your code of object-details view, maybe someone will write some code for you.
you could use this
next »
« previous

creating a drupal non-cached template variable

In drupal 6 I'm trying to execute a function on every page and output a different link based on what IP address someone is coming from. However, when I try this, it seems that the result is getting cached. I have tried this as a module and in template.php, but have not gotten results. What is the best approach to make sure this function executes on every page load? Or is there an easy way to create a template variable that does not get cached?
Is it possible for you to use a block instead with BLOCK_NO_CACHE or BLOCK_CACHE_PER_USER as the block caching policy? If you put a block like this in a region above/below you could achieve a very similar effect on any page you like, node or otherwise.