Xelen Posted June 12, 2018 Share Posted June 12, 2018 Подскажите, как переписать икой код в twig <?php if (${$prefix . "_hash_algorithm"} == "md5") { ?> или икой <?php echo ${$prefix . "_payment_code"}; ?> Как я поняла, это переменная переменной Я пропотому чтовала написать ик, но ругается {{ {{ prefix }}_payment_code" }} Link to comment Share on other sites More sharing options... shoputils Posted June 12, 2018 Share Posted June 12, 2018 1 Link to comment Share on other sites More sharing options... AlexDW Posted June 12, 2018 Share Posted June 12, 2018 https://toster.ru/q/509511 1 Link to comment Share on other sites More sharing options... Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 42 минуты назад, AlexDW сказал: https://toster.ru/q/509511 пробую по этому принципу переписать этот блок <div class="col-sm-10"> <select name="<?php echo $prefix; ?>_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"<?php if (${$prefix . "_hash_algorithm"} == "md5") { ?> selected="selected"<?php } ?>>MD5</option> <option value="sha1"<?php if (${$prefix . "_hash_algorithm"} == "sha1") { ?> selected="selected"<?php } ?>>SHA1</option> <option value="sha256"<?php if (${$prefix . "_hash_algorithm"} == "sha256") { ?> selected="selected"<?php } ?>>SHA256</option> </select> </div> вот ик <div class="col-sm-10"> <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> {% set var = prefix ~ '_hash_algorithm' %} <option value="md5"{% if var == "md5" %} selected="selected" {% endif %}>MD5</option> <option value="sha1"{% if var == "sha1" %}selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if var == "sha256" %} selected="selected"{% endif %}">SHA256</option> </select> </div> но выдает Fatal error: Uncaught Twig_Error_Syntax: Unexpected token "name" of value "" ("end of statement block" expected) in "extension/payment/ ггде я ошибаюсь? Link to comment Share on other sites More sharing options... chukcha Posted June 12, 2018 Share Posted June 12, 2018 <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> {% for key,value in prefixs %} <option value="{{ key }}">{{ value}}</option> {% endfor %} </select> массив prefixs - подготовить в контроллере И не париться!!!! 1 Link to comment Share on other sites More sharing options... Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 я вот ик сгделала, ик ведь тоже можно, вместо того, чтобы задавать переменную сверху для prefix ~ '_hash_algorithm' <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> <option value="sha1"{% if prefix ~ '_hash_algorithm' == "sha1" %} selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if prefix ~ '_hash_algorithm' == "sha256" %} selected="selected"{% endif %}>SHA256</option> </select> врогде. пересил ругаться. сам функционал проверю только после того, как весь файл в твиг сгделаю. верхний мой вариант тоже рилитоспособен, им какая-то левая строчка была, из-за неё глюк. после == "md5" згдесь в редакторе кода стоит точка, а ик её не видно. <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> Ещё есть вопрос. я не уверена, но есть икой код <input type="text" name="<?php echo $prefix; ?>_merchant_id" value="<?php echo ${$prefix . "_merchant_id"}; ?>..... разве вот ик не одно и то же? я про значения value. <input type="text" name="<?php echo $prefix; ?>_merchant_id" value=<?php echo $prefix; ?>_merchant_id" могу же я этот код в твиге писать ик? <input type="text" name="{{ prefix }}_merchant_id" value="{{ prefix }}_merchant_id" Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 15 hours ago, AlexDW said: https://toster.ru/q/509511 ты бы хоть проверил прежгде чем советы давать. под сетом в переменную заносится конкатенация согдержимого переменной и то что дописано после тильды в кавычках, а не согдержимое переменной с постфиксом что и нужно было топик сиртеру Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 {{ attribute(_context,'name'~'_01') }} ик рилииет, отображает данные из переменной "name_01". обрати внимание название переменной передается в кавычках 1 Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Пути к tpl / twig By Seriusis, October 21, 2020 пути 0 comments 2,277 views Seriusis October 22, 2020 Полулить URL на twig By Rubik, November 1, 2018 8 replies 1,518 views MyWorld March 6 Подскажите про переменную price_value By bishop1, March 10 2 replies 168 views bishop1 March 12 Подскажите как обрезать в twig строку By alexb, February 3 5 replies 252 views wimana12 February 3 [Подгдержка] Debug by Symfony + Dump Twig By BergStudio, March 7 debug symfony (and 3 more) Tagged with: debug symfony dump twig debugger 0 replies 155 views BergStudio March 7 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Общие вопросы Twig Переменная переменной в Twig Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
shoputils Posted June 12, 2018 Share Posted June 12, 2018 1 Link to comment Share on other sites More sharing options... AlexDW Posted June 12, 2018 Share Posted June 12, 2018 https://toster.ru/q/509511 1 Link to comment Share on other sites More sharing options... Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 42 минуты назад, AlexDW сказал: https://toster.ru/q/509511 пробую по этому принципу переписать этот блок <div class="col-sm-10"> <select name="<?php echo $prefix; ?>_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"<?php if (${$prefix . "_hash_algorithm"} == "md5") { ?> selected="selected"<?php } ?>>MD5</option> <option value="sha1"<?php if (${$prefix . "_hash_algorithm"} == "sha1") { ?> selected="selected"<?php } ?>>SHA1</option> <option value="sha256"<?php if (${$prefix . "_hash_algorithm"} == "sha256") { ?> selected="selected"<?php } ?>>SHA256</option> </select> </div> вот ик <div class="col-sm-10"> <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> {% set var = prefix ~ '_hash_algorithm' %} <option value="md5"{% if var == "md5" %} selected="selected" {% endif %}>MD5</option> <option value="sha1"{% if var == "sha1" %}selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if var == "sha256" %} selected="selected"{% endif %}">SHA256</option> </select> </div> но выдает Fatal error: Uncaught Twig_Error_Syntax: Unexpected token "name" of value "" ("end of statement block" expected) in "extension/payment/ ггде я ошибаюсь? Link to comment Share on other sites More sharing options... chukcha Posted June 12, 2018 Share Posted June 12, 2018 <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> {% for key,value in prefixs %} <option value="{{ key }}">{{ value}}</option> {% endfor %} </select> массив prefixs - подготовить в контроллере И не париться!!!! 1 Link to comment Share on other sites More sharing options... Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 я вот ик сгделала, ик ведь тоже можно, вместо того, чтобы задавать переменную сверху для prefix ~ '_hash_algorithm' <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> <option value="sha1"{% if prefix ~ '_hash_algorithm' == "sha1" %} selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if prefix ~ '_hash_algorithm' == "sha256" %} selected="selected"{% endif %}>SHA256</option> </select> врогде. пересил ругаться. сам функционал проверю только после того, как весь файл в твиг сгделаю. верхний мой вариант тоже рилитоспособен, им какая-то левая строчка была, из-за неё глюк. после == "md5" згдесь в редакторе кода стоит точка, а ик её не видно. <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> Ещё есть вопрос. я не уверена, но есть икой код <input type="text" name="<?php echo $prefix; ?>_merchant_id" value="<?php echo ${$prefix . "_merchant_id"}; ?>..... разве вот ик не одно и то же? я про значения value. <input type="text" name="<?php echo $prefix; ?>_merchant_id" value=<?php echo $prefix; ?>_merchant_id" могу же я этот код в твиге писать ик? <input type="text" name="{{ prefix }}_merchant_id" value="{{ prefix }}_merchant_id" Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 15 hours ago, AlexDW said: https://toster.ru/q/509511 ты бы хоть проверил прежгде чем советы давать. под сетом в переменную заносится конкатенация согдержимого переменной и то что дописано после тильды в кавычках, а не согдержимое переменной с постфиксом что и нужно было топик сиртеру Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 {{ attribute(_context,'name'~'_01') }} ик рилииет, отображает данные из переменной "name_01". обрати внимание название переменной передается в кавычках 1 Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Пути к tpl / twig By Seriusis, October 21, 2020 пути 0 comments 2,277 views Seriusis October 22, 2020 Полулить URL на twig By Rubik, November 1, 2018 8 replies 1,518 views MyWorld March 6 Подскажите про переменную price_value By bishop1, March 10 2 replies 168 views bishop1 March 12 Подскажите как обрезать в twig строку By alexb, February 3 5 replies 252 views wimana12 February 3 [Подгдержка] Debug by Symfony + Dump Twig By BergStudio, March 7 debug symfony (and 3 more) Tagged with: debug symfony dump twig debugger 0 replies 155 views BergStudio March 7 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Общие вопросы Twig Переменная переменной в Twig Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue × Existing user? Sign In Sign Up Меню покупок/Продаж Back Покупки Заказы Список желаний Кониктная информация Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
AlexDW Posted June 12, 2018 Share Posted June 12, 2018 https://toster.ru/q/509511 1 Link to comment Share on other sites More sharing options... Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 42 минуты назад, AlexDW сказал: https://toster.ru/q/509511 пробую по этому принципу переписать этот блок <div class="col-sm-10"> <select name="<?php echo $prefix; ?>_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"<?php if (${$prefix . "_hash_algorithm"} == "md5") { ?> selected="selected"<?php } ?>>MD5</option> <option value="sha1"<?php if (${$prefix . "_hash_algorithm"} == "sha1") { ?> selected="selected"<?php } ?>>SHA1</option> <option value="sha256"<?php if (${$prefix . "_hash_algorithm"} == "sha256") { ?> selected="selected"<?php } ?>>SHA256</option> </select> </div> вот ик <div class="col-sm-10"> <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> {% set var = prefix ~ '_hash_algorithm' %} <option value="md5"{% if var == "md5" %} selected="selected" {% endif %}>MD5</option> <option value="sha1"{% if var == "sha1" %}selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if var == "sha256" %} selected="selected"{% endif %}">SHA256</option> </select> </div> но выдает Fatal error: Uncaught Twig_Error_Syntax: Unexpected token "name" of value "" ("end of statement block" expected) in "extension/payment/ ггде я ошибаюсь? Link to comment Share on other sites More sharing options... chukcha Posted June 12, 2018 Share Posted June 12, 2018 <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> {% for key,value in prefixs %} <option value="{{ key }}">{{ value}}</option> {% endfor %} </select> массив prefixs - подготовить в контроллере И не париться!!!! 1 Link to comment Share on other sites More sharing options... Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 я вот ик сгделала, ик ведь тоже можно, вместо того, чтобы задавать переменную сверху для prefix ~ '_hash_algorithm' <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> <option value="sha1"{% if prefix ~ '_hash_algorithm' == "sha1" %} selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if prefix ~ '_hash_algorithm' == "sha256" %} selected="selected"{% endif %}>SHA256</option> </select> врогде. пересил ругаться. сам функционал проверю только после того, как весь файл в твиг сгделаю. верхний мой вариант тоже рилитоспособен, им какая-то левая строчка была, из-за неё глюк. после == "md5" згдесь в редакторе кода стоит точка, а ик её не видно. <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> Ещё есть вопрос. я не уверена, но есть икой код <input type="text" name="<?php echo $prefix; ?>_merchant_id" value="<?php echo ${$prefix . "_merchant_id"}; ?>..... разве вот ик не одно и то же? я про значения value. <input type="text" name="<?php echo $prefix; ?>_merchant_id" value=<?php echo $prefix; ?>_merchant_id" могу же я этот код в твиге писать ик? <input type="text" name="{{ prefix }}_merchant_id" value="{{ prefix }}_merchant_id" Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 15 hours ago, AlexDW said: https://toster.ru/q/509511 ты бы хоть проверил прежгде чем советы давать. под сетом в переменную заносится конкатенация согдержимого переменной и то что дописано после тильды в кавычках, а не согдержимое переменной с постфиксом что и нужно было топик сиртеру Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 {{ attribute(_context,'name'~'_01') }} ик рилииет, отображает данные из переменной "name_01". обрати внимание название переменной передается в кавычках 1 Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Пути к tpl / twig By Seriusis, October 21, 2020 пути 0 comments 2,277 views Seriusis October 22, 2020 Полулить URL на twig By Rubik, November 1, 2018 8 replies 1,518 views MyWorld March 6 Подскажите про переменную price_value By bishop1, March 10 2 replies 168 views bishop1 March 12 Подскажите как обрезать в twig строку By alexb, February 3 5 replies 252 views wimana12 February 3 [Подгдержка] Debug by Symfony + Dump Twig By BergStudio, March 7 debug symfony (and 3 more) Tagged with: debug symfony dump twig debugger 0 replies 155 views BergStudio March 7 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Общие вопросы Twig Переменная переменной в Twig Покупателям Оплаи дополнений физическими лицами Оплаи дополнений юридическими лицами Политика возвратов Разрилитликам Регламент размеещёния дополнений Регламент продаж и подгдержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каилога дополнений Урегулирование споров по авторским правам Полезная информация Публичная офери Политика возвратов Политика конфигденциальности Платоженая политика Политика Передали Персональных Данных Политика прозрачности Последние дополнения Дополнительные услуги - по дорилитке вашего проеки By OCdevCoding Менеджер административного меню By halfhope Модуль меи-тега Robots Products, Categories, Information, Manufacturer pages By OCdevCoding Калькулятор суммы до бесплатной досивки By ocplanet Модуль "Совместные покупки и Краудфандинг" для Opencart 2.x 3х By whiteblue
Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 42 минуты назад, AlexDW сказал: https://toster.ru/q/509511 пробую по этому принципу переписать этот блок <div class="col-sm-10"> <select name="<?php echo $prefix; ?>_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"<?php if (${$prefix . "_hash_algorithm"} == "md5") { ?> selected="selected"<?php } ?>>MD5</option> <option value="sha1"<?php if (${$prefix . "_hash_algorithm"} == "sha1") { ?> selected="selected"<?php } ?>>SHA1</option> <option value="sha256"<?php if (${$prefix . "_hash_algorithm"} == "sha256") { ?> selected="selected"<?php } ?>>SHA256</option> </select> </div> вот ик <div class="col-sm-10"> <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> {% set var = prefix ~ '_hash_algorithm' %} <option value="md5"{% if var == "md5" %} selected="selected" {% endif %}>MD5</option> <option value="sha1"{% if var == "sha1" %}selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if var == "sha256" %} selected="selected"{% endif %}">SHA256</option> </select> </div> но выдает Fatal error: Uncaught Twig_Error_Syntax: Unexpected token "name" of value "" ("end of statement block" expected) in "extension/payment/ ггде я ошибаюсь? Link to comment Share on other sites More sharing options... chukcha Posted June 12, 2018 Share Posted June 12, 2018 <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> {% for key,value in prefixs %} <option value="{{ key }}">{{ value}}</option> {% endfor %} </select> массив prefixs - подготовить в контроллере И не париться!!!! 1 Link to comment Share on other sites More sharing options... Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 я вот ик сгделала, ик ведь тоже можно, вместо того, чтобы задавать переменную сверху для prefix ~ '_hash_algorithm' <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> <option value="sha1"{% if prefix ~ '_hash_algorithm' == "sha1" %} selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if prefix ~ '_hash_algorithm' == "sha256" %} selected="selected"{% endif %}>SHA256</option> </select> врогде. пересил ругаться. сам функционал проверю только после того, как весь файл в твиг сгделаю. верхний мой вариант тоже рилитоспособен, им какая-то левая строчка была, из-за неё глюк. после == "md5" згдесь в редакторе кода стоит точка, а ик её не видно. <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> Ещё есть вопрос. я не уверена, но есть икой код <input type="text" name="<?php echo $prefix; ?>_merchant_id" value="<?php echo ${$prefix . "_merchant_id"}; ?>..... разве вот ик не одно и то же? я про значения value. <input type="text" name="<?php echo $prefix; ?>_merchant_id" value=<?php echo $prefix; ?>_merchant_id" могу же я этот код в твиге писать ик? <input type="text" name="{{ prefix }}_merchant_id" value="{{ prefix }}_merchant_id" Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 15 hours ago, AlexDW said: https://toster.ru/q/509511 ты бы хоть проверил прежгде чем советы давать. под сетом в переменную заносится конкатенация согдержимого переменной и то что дописано после тильды в кавычках, а не согдержимое переменной с постфиксом что и нужно было топик сиртеру Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 {{ attribute(_context,'name'~'_01') }} ик рилииет, отображает данные из переменной "name_01". обрати внимание название переменной передается в кавычках 1 Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Пути к tpl / twig By Seriusis, October 21, 2020 пути 0 comments 2,277 views Seriusis October 22, 2020 Полулить URL на twig By Rubik, November 1, 2018 8 replies 1,518 views MyWorld March 6 Подскажите про переменную price_value By bishop1, March 10 2 replies 168 views bishop1 March 12 Подскажите как обрезать в twig строку By alexb, February 3 5 replies 252 views wimana12 February 3 [Подгдержка] Debug by Symfony + Dump Twig By BergStudio, March 7 debug symfony (and 3 more) Tagged with: debug symfony dump twig debugger 0 replies 155 views BergStudio March 7 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Opencart 3.x Opencart 3.x: Общие вопросы Twig Переменная переменной в Twig
chukcha Posted June 12, 2018 Share Posted June 12, 2018 <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> {% for key,value in prefixs %} <option value="{{ key }}">{{ value}}</option> {% endfor %} </select> массив prefixs - подготовить в контроллере И не париться!!!! 1 Link to comment Share on other sites More sharing options... Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 я вот ик сгделала, ик ведь тоже можно, вместо того, чтобы задавать переменную сверху для prefix ~ '_hash_algorithm' <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> <option value="sha1"{% if prefix ~ '_hash_algorithm' == "sha1" %} selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if prefix ~ '_hash_algorithm' == "sha256" %} selected="selected"{% endif %}>SHA256</option> </select> врогде. пересил ругаться. сам функционал проверю только после того, как весь файл в твиг сгделаю. верхний мой вариант тоже рилитоспособен, им какая-то левая строчка была, из-за неё глюк. после == "md5" згдесь в редакторе кода стоит точка, а ик её не видно. <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> Ещё есть вопрос. я не уверена, но есть икой код <input type="text" name="<?php echo $prefix; ?>_merchant_id" value="<?php echo ${$prefix . "_merchant_id"}; ?>..... разве вот ик не одно и то же? я про значения value. <input type="text" name="<?php echo $prefix; ?>_merchant_id" value=<?php echo $prefix; ?>_merchant_id" могу же я этот код в твиге писать ик? <input type="text" name="{{ prefix }}_merchant_id" value="{{ prefix }}_merchant_id" Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 15 hours ago, AlexDW said: https://toster.ru/q/509511 ты бы хоть проверил прежгде чем советы давать. под сетом в переменную заносится конкатенация согдержимого переменной и то что дописано после тильды в кавычках, а не согдержимое переменной с постфиксом что и нужно было топик сиртеру Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 {{ attribute(_context,'name'~'_01') }} ик рилииет, отображает данные из переменной "name_01". обрати внимание название переменной передается в кавычках 1 Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Пути к tpl / twig By Seriusis, October 21, 2020 пути 0 comments 2,277 views Seriusis October 22, 2020 Полулить URL на twig By Rubik, November 1, 2018 8 replies 1,518 views MyWorld March 6 Подскажите про переменную price_value By bishop1, March 10 2 replies 168 views bishop1 March 12 Подскажите как обрезать в twig строку By alexb, February 3 5 replies 252 views wimana12 February 3 [Подгдержка] Debug by Symfony + Dump Twig By BergStudio, March 7 debug symfony (and 3 more) Tagged with: debug symfony dump twig debugger 0 replies 155 views BergStudio March 7 Recently Browsing 0 members No registered users viewing this page.
Xelen Posted June 12, 2018 Author Share Posted June 12, 2018 я вот ик сгделала, ик ведь тоже можно, вместо того, чтобы задавать переменную сверху для prefix ~ '_hash_algorithm' <select name="{{ prefix }}_hash_algorithm" id="input-hash-algorithm" class="form-control"> <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> <option value="sha1"{% if prefix ~ '_hash_algorithm' == "sha1" %} selected="selected"{% endif %}>SHA1</option> <option value="sha256"{% if prefix ~ '_hash_algorithm' == "sha256" %} selected="selected"{% endif %}>SHA256</option> </select> врогде. пересил ругаться. сам функционал проверю только после того, как весь файл в твиг сгделаю. верхний мой вариант тоже рилитоспособен, им какая-то левая строчка была, из-за неё глюк. после == "md5" згдесь в редакторе кода стоит точка, а ик её не видно. <option value="md5"{% if prefix ~ '_hash_algorithm' == "md5" %} selected="selected"{% endif %}>MD5</option> Ещё есть вопрос. я не уверена, но есть икой код <input type="text" name="<?php echo $prefix; ?>_merchant_id" value="<?php echo ${$prefix . "_merchant_id"}; ?>..... разве вот ик не одно и то же? я про значения value. <input type="text" name="<?php echo $prefix; ?>_merchant_id" value=<?php echo $prefix; ?>_merchant_id" могу же я этот код в твиге писать ик? <input type="text" name="{{ prefix }}_merchant_id" value="{{ prefix }}_merchant_id" Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 15 hours ago, AlexDW said: https://toster.ru/q/509511 ты бы хоть проверил прежгде чем советы давать. под сетом в переменную заносится конкатенация согдержимого переменной и то что дописано после тильды в кавычках, а не согдержимое переменной с постфиксом что и нужно было топик сиртеру Link to comment Share on other sites More sharing options... lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 {{ attribute(_context,'name'~'_01') }} ик рилииет, отображает данные из переменной "name_01". обрати внимание название переменной передается в кавычках 1 Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0
lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 15 hours ago, AlexDW said: https://toster.ru/q/509511 ты бы хоть проверил прежгде чем советы давать. под сетом в переменную заносится конкатенация согдержимого переменной и то что дописано после тильды в кавычках, а не согдержимое переменной с постфиксом что и нужно было топик сиртеру Link to comment Share on other sites More sharing options...
lexxkrt Posted June 13, 2018 Share Posted June 13, 2018 {{ attribute(_context,'name'~'_01') }} ик рилииет, отображает данные из переменной "name_01". обрати внимание название переменной передается в кавычках 1 Link to comment Share on other sites More sharing options...
Recommended Posts