Making an image dynamic
Permalink
I have Concrete5 site that I'm supposed to edit. I have a MySQL database that I want to connect to in order to load an image to the site (so that whenever I change that image in database it is reflected to the site as well). Should I do this from the dashboard of the site somehow?
I have no previous experience of Concrete5 at all. PHP and MySQL yes, but outside of these platforms.
I have no previous experience of Concrete5 at all. PHP and MySQL yes, but outside of these platforms.
Thanks for the quick answer!
Yes, I have a second database, but I can use the same one as the original if needed - I'd just create a new table there, that would be enough.
It would be good enough to just overwrite the current image. I just have to be able to do it automatically (because multiple places should contain the same image -> updating program should push it to everywhere). Right now the image is in separate database, but that is not required.
Yes, I have a second database, but I can use the same one as the original if needed - I'd just create a new table there, that would be enough.
It would be good enough to just overwrite the current image. I just have to be able to do it automatically (because multiple places should contain the same image -> updating program should push it to everywhere). Right now the image is in separate database, but that is not required.
I guess putting it into a block would do. Here are some links to get you started.
https://www.concrete5.org/documentation/developers/5.7/working-with-...
https://www.concrete5.org/documentation/developers/5.7/working-with-...
If you are new to concrete5, be ready to spend some time reading on it.
https://www.concrete5.org/documentation/developers/5.7/working-with-...
https://www.concrete5.org/documentation/developers/5.7/working-with-...
If you are new to concrete5, be ready to spend some time reading on it.
Seems like the db.xml isn't the answer either. It says
"db.xml
This file is required for any block that needs to save its data in the database-- which is most of them. This file contains an XML description of the database tables needed, in the AXMLS format. For more information, see (Creating and Working with db.xml Files)[http://www.concrete5.org/documentation/how-tos/developers/creating-and-working-with-db-xml-files/]"
I don't need to save. I only need to read.
"db.xml
This file is required for any block that needs to save its data in the database-- which is most of them. This file contains an XML description of the database tables needed, in the AXMLS format. For more information, see (Creating and Working with db.xml Files)[http://www.concrete5.org/documentation/how-tos/developers/creating-and-working-with-db-xml-files/]"
I don't need to save. I only need to read.
You can define a 2nd table in db.xml.
No need to save data to it.
Also and this is probably the way to go, Iknow there is some post or how-to about connecting a 2nd dbase. I used it myself.
Im not behind a compu so forgive me my mistakes...
I think it's defined in app.php or connection.php. or some other config file. Define your 2nd dbase there and
$db2 = connection ('seconddb').
Good luck.
No need to save data to it.
Also and this is probably the way to go, Iknow there is some post or how-to about connecting a 2nd dbase. I used it myself.
Im not behind a compu so forgive me my mistakes...
I think it's defined in app.php or connection.php. or some other config file. Define your 2nd dbase there and
$db2 = connection ('seconddb').
Good luck.
This is possible, but before digging into this, I want to make sure this is what you want.
- Does the image need to be refreshed/changed automatically without interaction ?
This would need some code...The best place to create this depends on your needs.
It could be done with a block, attribute, or hard-coded in a theme...