My website is getting spammed with entries such as:
<a style="text-decoration:none" href="/amoxicillin-kamagra-shop">.</a>
I want to filter those out with jQuery, as there are too many to do it manually through the UI (wayyy too tedious). The challenge is determining the SPAM-matching criteria, such as the HTML tag info.
So, for example, if I determine that most or all spam is of the form
<a style="text-decoration:none ... >.</a>
How would I delete those entries with jQuery?
DELETE from yourtable WHERE string like '<%a style="text-decoration:none%>.%'
Related
I went through the Merge Tags here and here, but couldn't figure out the syntax that would allow me to show content based on whether the user has certain Tag or not.
Help?
My goal in case it helps:
User subscribes, and is queued for a welcome mail one day later. In meantime that user may get tagged (my way of segmenting them), and so, the next day when that user receives the welcome mail, the content needs to be catered based on the tag that user got.
Got a response from their support saying
merge tags do not work with Tags just yet
here's the whole thing:
While we do have conditional merge tags available, I'm afraid we do
not have any that would work with Tags. To be transparent, Tags were
recently added a few months ago, and there are some features in our
application that has not updated to work with Tags just yet.
Because conditional merge tags do not work with tags yet, the best
option would be to create multiple automations and send them out based
on each tags. If you do it that way, you'll be able to target those in
specific tags with specific content
Dug a little deeper from the first link. There is another link Use Conditional Merge Tag Blocks which contained the below code:
Name
IF-ELSE
Definition
Use ELSE to indicate alternative content to display if the *|MERGE|* tag value is false.
Example
*|IF:MERGE|* content to display *|ELSE:|* alternative content to display *|END:IF|*
Name
ELSEIF
Definition
Use ELSEIF to specify a new *|MERGE|* tag to be matched against if the first *|MERGE|* tag value is false.
Example
*|IF:TRANSACTIONS >= 20|* Enjoy this 40% off coupon! *|COUPON40|*
*|ELSEIF:TRANSACTIONS >= 10|* Enjoy this 20% off coupon! *|COUPON20|*
*|ELSE:|* Enjoy this 10% off coupon! *|COUPON10|* *|END:IF|*
More examples with definitions can be found here.
Hope this is the answer you were after.
I'm new with liquid and ruby, but I would like to create a custom filter in a collection, to filter by metafields. I already have:
A dropdown in the collection.liquid, with the values I would like to filter for.
When selecting a filter, it goes to a link like: https://myshop.myshopify.com/collections/my-collection/my-filter . Basically it is like the tags, but with my filter instead
However, since it is a custom filter and not a tag, I get no results. I'm wondering where is the query that displays all the products (or filters) is in the code. I know that it depends on the theme, but I'm using the default theme: launchpad-star.
Not sure if I could do it this way or with a link like: https://myshop.myshopify.com/collections/my-collection?filter_by=my-filter , in which case, I would also need where should the logic go.
I've looked at the forums already and found two closed tickets with no responses: https://ecommerce.shopify.com/c/ecommerce-design/t/using-metafields-to-create-filter-drop-downs-in-collection-liquid-187513 and https://ecommerce.shopify.com/c/ecommerce-design/t/using-metafields-to-create-filter-drop-downs-in-collection-liquid-134401 .
Thanks in advance
Probably not the best solution, but this is what I did to solve the problem:
I changed to the second option of the url, so when a user selects an option in the combobox, it is sent to a URL like: myshop.myshopify.com/collections/my-collection?filter_by=my-filter
In product-grid-item.liquid, I'm getting the metafield value of the product and displaying it as a class, and hide all the products as default. In the collection.liquid I read with javascript the value of the parameter (filter_by) and remove the "hide" class of the products with the value of the filter_by as class, so it gets displayed.
I feel that it is not very clean, but it is working as expected. Problems with this solution:
* Not displaying all the products and then filtering them
* I need to display all the products to avoid pagination, which could be a big problem if I have a lot of products.
If anyone could post a better solution, welcome!.
First of all, thanks a lot for amazing plugin!
I have Datatable with server-side processing. When I choose one option from dropdown, I got 2 selected options: one I choose, and another empty. I mean I got this:
<ul class="select2-selection__rendered">
<li class="select2-selection__choice" title=""></li>
<li class="select2-selection__choice" title="option1"></li>
<li class="select2-search select2-search--inline"></li>
</ul>
It makes wrong SQL query (in LIKE operator I got something like '|option1'). I can get correct query with php script, but it won't remove empty selected option from header of my table.
Would be appreciated for any help.
You are welcome,
Looks like you using a multi select filter on some column, and thats why yadcf sends strings with | (OR) to your server.
On your server side you have to do the split of the string into array/list of string and construct a proper sql query.
Split in Java
Split in PHP(see code sample in bottom
p.s I'm the author of yadcf
I'm trying to use jsp to rendering a simple database and have the ability to delete a row using a button. I'm running into the trouble of not being able to fetch the primary key from the row because I've been using to iterate through the table. I've tried passing just simple numbers to denote the primary key (integers) but its not grabbing it.
Lets say I want to delete the row with the primary key of 12.
<form action="deleteResponse.jsp">
<c:set var="numId" value="12"/>
<input type="submit" name="delete" value="Delete"/>
</form>
This generates a button which opens up deleteResponse.jsp which has the following to catch the value.
<sql:update var="counselorDelete" dataSource="jdbc/IFPWAFCAD">
DELETE FROM Counselor
WHERE counselor_id = ?<sql:param value="${param.numId}"/>
</sql:update>
It's not doing anything, and I'm not sure whats going on with it. If I manually put in the value 12 in the sql query it will delete the row but it won't do it if I try to fetch the value.
Thanks very much in advance!
Also as a side note. I'm having a hard time understanding how to properly write JSPs. I see that most of the time people use <% Java code %> but in the netbean tutorial, it uses the and functions. Could someone explain that to me? I'm also using glassfish as a localhost sql server. Netbean generates a glassfish xml but I also see people using DriverManager.getConnection methods. Which one is conventionally better?
I would try to separate the UI/JSP code from the DAO layer, using a seperate Bean to handle all the insert/uodate/delete operations.
Take a look at the logfiles of your Applicationserver, this might give you some hints.
Kr, R
Edit: Concerning the sql:
<sql:update var="counselorDelete" dataSource="jdbc/IFPWAFCAD"
sql="DELETE FROM Counselor WHERE counselor_id = ?" >
<sql:param value="${param.numId}"/>
</sql:update>
I have a single Classic ASP page that I wish to display a search form and the associated results.
When a user first comes to this page, I want to display a search form and the 10 latest properties. If a user decides to use the search form to retrieve more relevant properties, then i want the default 10 latest properties to be replaced with the users' paged search results.
I was wondering if this is possible/practical within the confines of one page and if so, does anyone have any hints on how i could best achieve this?
This is my preliminary code for such a page;
http://gist.github.com/188770
Once again, i'm currently having to patch an existing ASP site until I can redevelop it in something more modern like PHP.
Thank you for any help offered.
Neil.
It's certainly very possible and practical. Typically the solution is to postback to yourself and have code in the page that detects if you arrived there from a post or a get. Get meant show the 10 latest properties, post means you do a search and show the results.
if (Request.ServerVariables("REQUEST_METHOD") = "POST") then
' arrived via post, get form values and do search
else
' arrived via get, show last 10 results
end if
You probably want to display what the user searched for in the form when you display the result:
<label>Street: <input type="text" name="searchStreet" value="<%=Server.HtmlEncode(Request("searchStreet") & "") %>" /></label>
Adding a empty string is for casting to string to not give an error when the key wasn't found, eg. on first visit.
If you want to you can make the loop prettier:
do until myRecordSet.EOF
%>
<div class='result'>")
<dl><%=myRecordSet("ContentTitle")%><dl>
<dt><%=myRecordSet("ContentStreet")%><dt>
<dt><%=myRecordSet("ContentTown")%><dt>
<dt><%=myRecordSet("ContentPostcode")%><dt>
</div><%
myRecordSet.MoveNext
loop
You probably want to Server.HtmlEncode there as well...
(ps ASP is actually one year younger than PHP... if you want something modern you might want to look at python, ruby or asp.net mvc before PHP, as it's easier to write bad code in PHP than in any of those. ds)