Formatting url to search for specific verses
-
- Member
- Posts: 54
- Joined: Tue Nov 22, 2011 12:34 pm
Formatting url to search for specific verses
If I know the verse I want to find how do I format the url? I am trying to code the url in another app.
(E.g. I input 1:Cor. 1:21-25 and the search returns that page with the reference highlighted and a well formed url to paste into a hyperlink.
Thanks
(E.g. I input 1:Cor. 1:21-25 and the search returns that page with the reference highlighted and a well formed url to paste into a hyperlink.
Thanks
- sbradshaw
- Community Moderators
- Posts: 6252
- Joined: Mon Sep 26, 2011 9:42 pm
- Location: Utah
- Contact:
Re: Formatting url to search for specific verses
This is the current format for scripture references:
https://www.lds.org/scriptures/nt/1-cor ... ng=eng#p21
https://www.lds.org/scriptures/nt/1-cor ... ng=eng#p21
- https://www.lds.org OR gospellibrary://content – LDS.org or the Gospel Library app.
- /scriptures – section of LDS.org or content type.
- /nt – testament / work / volume of scripture (ot / nt / bofm / dc-testament / pgp).
- /1-cor – scripture book.
- /1 – chapter.
- ?verse=21-25 – verse(s) to put a callout box around, optional. If not specified, no callout boxes will be drawn. This can be a single verse, a range, or a series (for example, "2-5,7" is valid).
- &lang=eng – language, optional. If not specified, link will default to the browser/device language (which could give an error if the content doesn't exist in that language).
- #p21 – verse to scroll to, optional. If not specified, chapter will load to the top.
Samuel Bradshaw • If you desire to serve God, you are called to the work.
-
- Member
- Posts: 54
- Joined: Tue Nov 22, 2011 12:34 pm
Re: Formatting url to search for specific verses
If you go to scriptures.lds.org you can see a field that allows search criteria. If you entered 1 Cor. 1:22-25 in that field it would navigate to a url very similar to what you defined. I want to know how to format a url to feed the form not how to format the url it finds. I suppose it will have a GET in it but my skills at HTML queries are inadequate.
- sbradshaw
- Community Moderators
- Posts: 6252
- Joined: Mon Sep 26, 2011 9:42 pm
- Location: Utah
- Contact:
Re: Formatting url to search for specific verses
If you go to LDS.org/scriptures, then disconnect your internet connection (to prevent redirects), then type a reference in the scriptures search box and press enter, you can see what URL the form tries to load. For 1 Cor. 1:21–25, this is what I got in the address bar:
https://www.lds.org/scriptures/search?l ... 25&x=0&y=0
I'm not sure what the x and y parameters do – I think they can be removed. So:
https://www.lds.org/scriptures/search?lang=eng&query=[url-encoded scripture reference]
https://www.lds.org/scriptures/search?l ... 25&x=0&y=0
I'm not sure what the x and y parameters do – I think they can be removed. So:
https://www.lds.org/scriptures/search?lang=eng&query=[url-encoded scripture reference]
Samuel Bradshaw • If you desire to serve God, you are called to the work.
-
- Member
- Posts: 54
- Joined: Tue Nov 22, 2011 12:34 pm
Re: Formatting url to search for specific verses
This is good but no better than just formatting it. The must be an HTML FORM and a GET method that will accept the string "1 Cor. 1:21-22".
I am trying to get the system to perform the URL formatting for me.
I am trying to get the system to perform the URL formatting for me.
- sbradshaw
- Community Moderators
- Posts: 6252
- Joined: Mon Sep 26, 2011 9:42 pm
- Location: Utah
- Contact:
Re: Formatting url to search for specific verses
What are you hoping for it to return? A JSON file of some sort?
Samuel Bradshaw • If you desire to serve God, you are called to the work.
-
- Senior Member
- Posts: 3907
- Joined: Mon Sep 24, 2007 9:17 am
- Location: Cumming, GA, USA
Re: Formatting url to search for specific verses
Based on the query parameters the form should be something like this (I haven't tested this so the it may be missing details but the gist should be right):corwinslack wrote:This is good but no better than just formatting it. The must be an HTML FORM and a GET method that will accept the string "1 Cor. 1:21-22".
I am trying to get the system to perform the URL formatting for me.
Code: Select all
<form action="https://www.lds.org/scriptures/search" method="get">
<input type="hidden" name="lang" value="eng"></input>
<input type="text" name="query"></input>
</form>
-
- Member
- Posts: 54
- Joined: Tue Nov 22, 2011 12:34 pm
Re: Formatting url to search for specific verses
Thanks! Which of those fields gets my input string 1 Cor. 1:21-24 ?
-
- Member
- Posts: 54
- Joined: Tue Nov 22, 2011 12:34 pm
Re: Formatting url to search for specific verses
Would it be something like
<input type="text" name="query" value="1 Cor. 1:21-24"></input>
<input type="text" name="query" value="1 Cor. 1:21-24"></input>
-
- Senior Member
- Posts: 3907
- Joined: Mon Sep 24, 2007 9:17 am
- Location: Cumming, GA, USA
Re: Formatting url to search for specific verses
Only one of those fields will show up on the screen (name="query" type="text"). That's the one where the input string is entered. The other (name="lang") is hidden and is just there to add the language to the URL.corwinslack wrote:Thanks! Which of those fields gets my input string 1 Cor. 1:21-24 ?