Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:13:23+00:00 2026-06-08T09:13:23+00:00

Is there a way I can modify dynamically the param of a snippet? E.g.

  • 0

Is there a way I can modify dynamically the param of a snippet?

E.g. If I call this URL

host:port/a_page?name=myname

I would like that my page look like this:

<div class="lift:surround?with=default;at=content">
   <div class="lift:comet?type=MySnippet;name=myname" >
      ...
   </div>
</div>

Is that even possible? I tried using some javascript in order to extract the param from the url and putting it in the class attribute of the div but in my understanding that won’t work becase the scripts will always execute after lift framework does it’s magic.

Thanks in advance! Any help is really appreciated.


I used both tips provided to make it work, like ajantis mentioned reading the param directly from snippet is the easiest way but doesnt work in a comet call. Rogach solution works.

So the solution is:

<div class="lift:Ex.wrap">
  <div id="myid"></div>
</div>

def wrap = { 
val name = "lift:comet?type=MySnippet;name=" + S.param("name").openOr("...")            
"#myid" #> <div id="myid" class={name} ></div>
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:13:25+00:00Added an answer on June 8, 2026 at 9:13 am

    You can try wrapping that comet snippet in other snippet, which would transform xml and add that name=myname to class. Like:

    <div class="lift:Ex.wrap">
      <div class="lift:comet?type=MySnippet"></div>
    </div>
    
    class Ex {
      def wrap = { (n: NodeSeq) =>
        // example transformation
        // AntiXML syntax
        import com.codecommit.antixml._;
        val comet = n \ "div" head;
        val comet2 = 
          comet.copy(attrs = comet.attrs +
                             ("class" -> (comet.attrs("class") + ";name=myname")))
        n \ "div" updated (0, comet2) unselect
      }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way I can modify the URL of the current page without
Is there a way I can detect an image URL, like: http://mysite.com/image.jpg but with
In short: is there some way I can modify a class definition such that
I'd like to know if there is a way to dynamically modify/access the data
Is there any way I can modify some style to all elements that matches
Is there a way to customise the devise controllers , as we can modify
Is there any way can declare a bean in just like JSP UseBean in
Is there way that I can read the file from remote server using fopen
Is there any way I can set a formatter on models that will convert
Is there any way we can fetch X509 Public Cetrificates using c# from AD

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.