HTML / Javascript help
Discussion
Morning,
I have a widget to embed in a website from the CQC which looks as follows:
https://www.cqc.org.uk/guidance-providers/ratings/...
(I can't post it here as PH blocks it
Nice and easy and it works perfectly. However, as they have a few sites, the LocationID is stored in a mySQL database as a alpha-numeric field which I cannot get to populate.
I'm guessing it is because its sitting in the middle of a URL text string, but my coding skills is not sufficient enough to work out the correct way to split and splice together again.
Could anyone advise of the correct way please
I have a widget to embed in a website from the CQC which looks as follows:
https://www.cqc.org.uk/guidance-providers/ratings/...
(I can't post it here as PH blocks it
Nice and easy and it works perfectly. However, as they have a few sites, the LocationID is stored in a mySQL database as a alpha-numeric field which I cannot get to populate.
I'm guessing it is because its sitting in the middle of a URL text string, but my coding skills is not sufficient enough to work out the correct way to split and splice together again.
Could anyone advise of the correct way please
This is a bit confusing.
Are you saying you have several websites that are powered from MySQL databases (the same one? one or more each?) that all need to embed this widget?
"as they have a few sites", who is they in this context? The company you are doing this work for? Your opening comment talks about embedding this CQC widget in a website, not several.
What language(s) are the website(s) written in that you're trying to embed this widget on?
If you're embedding this widget on multiple websites, and they all use their own distinct MySQL database, and this LocationID doesn't change for each website, why not just hardcode it?
Are you saying you have several websites that are powered from MySQL databases (the same one? one or more each?) that all need to embed this widget?
"as they have a few sites", who is they in this context? The company you are doing this work for? Your opening comment talks about embedding this CQC widget in a website, not several.
What language(s) are the website(s) written in that you're trying to embed this widget on?
If you're embedding this widget on multiple websites, and they all use their own distinct MySQL database, and this LocationID doesn't change for each website, why not just hardcode it?
Durzel said:
This is a bit confusing.
Are you saying you have several websites that are powered from MySQL databases (the same one? one or more each?) that all need to embed this widget?
"as they have a few sites", who is they in this context? The company you are doing this work for? Your opening comment talks about embedding this CQC widget in a website, not several.
What language(s) are the website(s) written in that you're trying to embed this widget on?
If you're embedding this widget on multiple websites, and they all use their own distinct MySQL database, and this LocationID doesn't change for each website, why not just hardcode it?
Hi, yes i can understand the confusion. Are you saying you have several websites that are powered from MySQL databases (the same one? one or more each?) that all need to embed this widget?
"as they have a few sites", who is they in this context? The company you are doing this work for? Your opening comment talks about embedding this CQC widget in a website, not several.
What language(s) are the website(s) written in that you're trying to embed this widget on?
If you're embedding this widget on multiple websites, and they all use their own distinct MySQL database, and this LocationID doesn't change for each website, why not just hardcode it?

It's one website and one database.
There are various physical sites (nursing homes), not web sites which each have a profile page on the website and their own rating.
Herbs said:
Durzel said:
This is a bit confusing.
Are you saying you have several websites that are powered from MySQL databases (the same one? one or more each?) that all need to embed this widget?
"as they have a few sites", who is they in this context? The company you are doing this work for? Your opening comment talks about embedding this CQC widget in a website, not several.
What language(s) are the website(s) written in that you're trying to embed this widget on?
If you're embedding this widget on multiple websites, and they all use their own distinct MySQL database, and this LocationID doesn't change for each website, why not just hardcode it?
Hi, yes i can understand the confusion. Are you saying you have several websites that are powered from MySQL databases (the same one? one or more each?) that all need to embed this widget?
"as they have a few sites", who is they in this context? The company you are doing this work for? Your opening comment talks about embedding this CQC widget in a website, not several.
What language(s) are the website(s) written in that you're trying to embed this widget on?
If you're embedding this widget on multiple websites, and they all use their own distinct MySQL database, and this LocationID doesn't change for each website, why not just hardcode it?

It's one website and one database.
There are various physical sites (nursing homes), not web sites which each have a profile page on the website and their own rating.
What reason is the LocationID in the database? Does the LocationID change depending on factors - e.g. does this widget need to be shown alongside search function results for the muitiple sites?
Wouldn't it be easier to just do a replace?
We have this url
and we just need to replace LocationID with the locationid pulled from a database. Don't do PHP but there must be replace function to do that?
We have this url
https://www.cqc.org.uk/sites/all/modules/custom/cqc_widget/widget.js?data-id=LocationID&data-host=www.cqc.org.uk&type=location
and we just need to replace LocationID with the locationid pulled from a database. Don't do PHP but there must be replace function to do that?
Guessing you've got a page per location and your pulling all the info for it from the database? Would need to see the code, but as a total stab in the dark, you'd need to echo the location id from the row returned from the database into the widget url server side:
<?=$row->locationID ?>
I'm a freelance software engineer and do a fair bit of PHP work, DM me if you need some further support with this
<?=$row->locationID ?>
I'm a freelance software engineer and do a fair bit of PHP work, DM me if you need some further support with this

Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


