njohn Posted March 4, 2017 Share Posted March 4, 2017 I need to put 64+ images in a two column table. Doing it one by one would be quite troublesome and in addition I'll want to do it several times with different images on several pages. Is it possible/how to do? Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 4, 2017 Share Posted March 4, 2017 It seems like what you want is for some sort of automation. If so, then Smarty can accept an array and build a table around it. So, the following is a concise example: $imgArray = ( "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", ); $GLOBALS['smarty']->assign('imgArray', $imgArray); Then, in the template where you want the table: {* See http://www.smarty.net/docs/en/language.function.html.table.tpl *} {html_table loop=$imgArray cols=2} Quote Link to comment Share on other sites More sharing options...
njohn Posted March 4, 2017 Author Share Posted March 4, 2017 My icon is appropriate - what/where is smarty? DUH! It is at the url in your answer. I'll check it out - THANKS! Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 4, 2017 Share Posted March 4, 2017 Smarty is a template rendering engine. It is an included library (/includes/lib/smarty/) and is what CubeCart uses to populate the templates with data. Quote Link to comment Share on other sites More sharing options...
njohn Posted March 4, 2017 Author Share Posted March 4, 2017 Ah so - that sounds like what I need - I'll post results later today Thank you Quote Link to comment Share on other sites More sharing options...
njohn Posted March 4, 2017 Author Share Posted March 4, 2017 6 hours ago, bsmither said: $imgArray = ( "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", ); $GLOBALS['smarty']->assign('imgArray', $imgArray); Where do I put this? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted March 4, 2017 Share Posted March 4, 2017 I saw some promising looking information when I Googled "how to design a smarty table". But this is WAY past my abilities!! Bsmither will be the one who'll know exactly how to help you. Quote Link to comment Share on other sites More sharing options...
njohn Posted March 4, 2017 Author Share Posted March 4, 2017 3 minutes ago, Dirty Butter said: I saw some promising looking information when I Googled "how to design a smarty table". But this is WAY past my abilities!! Bsmither will be the one who'll know exactly how to help you. You cared enough to try Quote Link to comment Share on other sites More sharing options...
bsmither Posted March 4, 2017 Share Posted March 4, 2017 Currently, that would depend where you want this table to appear. The topic subject says "Category page", so I conclude you will want to make the data available to Smarty before Smarty renders the "content.category.php" template. There are two main places where you can add this: in the Catalogue class, the searchCatalogue() function (showing the products in a category is actually a search), and then the displayCategory() function. In searchCatalogue(), we can use whatever is going on in the search for products (even if it is searching for all products in a given category) to determine what set of images we want to show. In displayCategory(), we can use whatever is going on with the category itself, its description, and its sub-categories. Quote Link to comment Share on other sites More sharing options...
njohn Posted March 5, 2017 Author Share Posted March 5, 2017 Issue overcome by changing consideration - images are too small when displayed in a 2 col table . So I have to show them in 1 col, negating the need to use a table. But thank you bsmither for your typical willingness to assist. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.