0

I have added some links in top. i want get query param from url and append in to every links in top dynamically

like my links are = test1, test2, test3

My mail url is = https://apcd.com

When some one use = https://abcd.com?id=123

When any one click on any link in top normally it will open like = https://abcd.com/test1 but i need https://abcd.com/test1?id=123

I am able to add like this but user changed https://abcd.com?id=1234 immediately not effecting in to that links when i flush cache that time only it effecting any idea to resolve this issue

I have create one phmtl file

 <?php  $blockObject= $block->getLayout()->createBlock('Exinent\Customerids\Block\Index');
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$id = $blockObject->getRequest()->getParam('id');

$storeurl=$storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB);
$storeurl = rtrim($storeurl, '/');
?>
<li class="nav item ui-menu-item" role="presentation">
    <a href="<?php echo $storeurl.'/home'.$id; ?>" id="ui-id-3" class="ui-corner-all" tabindex="-1" role="menuitem">home</a>
</li>
<li class="nav item ui-menu-item" role="presentation">
    <a href="<?php echo $storeurl.'/our-experts'.$id; ?>" id="ui-id-4" class="ui-corner-all" tabindex="-1" role="menuitem">OUR EXPERTS</a>
</li>
<li class="nav item ui-menu-item" role="presentation">
    <a href="<?php echo $storeurl.'/about-us'.$id; ?>" id="ui-id-5" class="ui-corner-all" tabindex="-1" role="menuitem">ABOUT US</a>
</li>
<li class="nav item ui-menu-item" role="presentation">
    <a href="<?php echo $storeurl.'/contact'.$id; ?>" id="ui-id-6" class="ui-corner-all" tabindex="-1" role="menuitem">SUPPORT</a>
</li>
<li class="nav item ui-menu-item" role="presentation">
    <a href="<?php echo $storeurl.'/faq-s'.$id; ?>" id="ui-id-7" class="ui-corner-all" tabindex="-1" role="menuitem">FAQS</a>
</li>

I called this file default_head_blocks.xml it i showing fine

  • Can you please update your question with what you did so far. – Ramkishan Suthar Oct 31 '18 at 15:13
  • @Ramkishan updated pls check once – Pawankumar Oct 31 '18 at 15:19
  • I can see that they are cms pages links, when you append $id then it'll become home1234, contatc1234 etc. Can you please explain bit more what is exactly you want to do from this. – Ramkishan Suthar Oct 31 '18 at 15:25
  • i will apped ? in between.like home?1234. when you link abcd.com?id=1234.after some i will change abcd.com?id=1235 but not effecting in all links when i flush cache and refresh it will effect – Pawankumar Oct 31 '18 at 15:40
  • @Ramkishan samelike need to manupulate every url like below magento.stackexchange.com/questions/5000/… – Pawankumar Oct 31 '18 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.