How to customize/add logic in Strapi CMS Relation-Ship - sql

I need your help in Strapi CMS.
my case is simple.
Here i made on collection type. that is called Center and next one is post.
here Center has many Posts relation.
all centers title
ind_chennai
ind_goa
ksi_mumbai
some post content_title
POST 1
POST 2
When I add/edit a post, I want to show only any center title starting with ind_ in the dropdown.
My problem is if I have to write the logic for this, where do I write it? if you know that way please tell me guys.
Details:
strapi v4
sqlite / psql

Related

How to modify product page using Theme and Asset api for a shopify App

I am creating a Shopify app that will insert a trust seal or badge on the product page. However, there is difficulty in implementing it since there is no clear documentation or tutorials on how to do it. What I want to achieve is to place an image (trust badge) somewhere before or after the Add to cart button. This is a public app, so modifying the theme through Shopify API themes/assets is the only option to do it dynamically.
Shopify is really new to me. I just studied it for 3 weeks, maybe someone who has prior experience in implementing this would help me.
Please refer to the image for reference.
Thank you in advance! :-)

Comment functionality on every page in Yii 1.1

I am using Yii 1.1.16 for one of my projects.
I have 5 controllers at the moment, and their data is coming from their respective models.
Now I want to add new functionality into my website, regarding comments. I want to add a form at the bottom of each view, but obviously the data will be coming from another database table (I have created a new model for that).
I am confused. Should I create 5 different forms in HTML for my problem, or can I use Yii widgets functionality to implement the same?
The Comment table would be the same for every user in the database. Comments will be coming with the help of their user id, which is stored in the table, and their comment will be inserted with the help of their user id, too.
Please let me know the best solution you can think of.
I suggest to create one widget for displaying comments section and one controller for handling request from this widget (for example adding new comment or displaying different page of comments list). In this way adding comments for any section should require only few lines of code to initialize widget:
$this->widget('CommentsWidget', [
'parentId' => 'page-' . $model->id,
]);

How to know the pages where an image is displayed in wordpress

I am not sure if this is possible since I've been googling about this issue but I couldn't find any solution. I am on media of wp-admin, and I am trying to view the pages where a specific image has been used. I am a developer and I don't know how it is done. Anybody help?
Example:
image.jpg
has been displayed in :
www.mydomain.com/
www.mydomain.com/page-1
www.mydomain.com/page-2
I don't know how. Please help.
If you have access to the database, you can make a search for all occurrences of the image link in all posts and pages. To do this you need to get the link of the image through the admin menu. You will have something like:
http://example.com/wp-content/uploads/2016/03/image.png
The post and page content are located in the table wp_posts (Replace "wp_" with your table prefix if not using the default). Now you can do a query like:
SELECT `ID`, `post_title`, `guid` FROM `wp_posts`
WHERE `post_content` LIKE '%http://example.com/wp-content/uploads/2016/03/image.png%'
This will give you the post titles and their links. Should be something like:
ID post_title guid
9 Post Title 1 http://www.example.com/?page_id=9
20 Post Title 2 http://www.example.com/?page_id=20
In Media change the view to List view where you will be able to see which image is attached to which post.
All the images are uploaded under
wp-content/uploads folder
you will inspect using firebug and get the path of the image.
Thanks

Sugestions for textfield

i have a question about a suggestion possibility in textfields.
What i am looking for is a script that gives user suggestions for the text they type.
It is used for a song request page of a radio station, and what i am looking for is a script that provides suggestions for the artists, and after filling the artist form, automatically suggest songs by the requested artist.
We like to create a more easy request form for our listeners, so they first type the artist, and offcourse the artists shown are available in our database, and than when they complete the artist field, automatically the system knows the songs available for that artist, and give the suggestions for the song.
I hope this is understandable and i hope you can give me suggestions about this.
Thank you for your help and looking forward to your answers.
Since you say "page" I assume you are talking about a web page. A standard way to do this then would be the JQuery Autocomplete UI widget.

Tumblr like button not working after infinite scroll ajax recall

There are a few similar posts but they are quite out of date and Tumblr has updated the like part of the API not too long ago as far as I'm aware.
Creating a like button is as simple as
{LikeButton}
and this works great, but after the ajax recalls to get more posts from what would be the next page, the like button no longer works.
I have had a look at the documentation and it states that I need to implement one of the following, I was wondering if anyone could point me in the right direction? I've been trying to get this to work for hours.
I made up an example blog if this helps contribute to answering, the javascript can do the mass amount of the implementing of new images.
http://stackoverflowexample.tumblr.com/
If you need anymore info, i'll happily edit this and add what's required, thank you!
Overview
Adapted from my previous answer here: Using Tumblr Like Button with Infinite Scroll
Tumblr states we need to call one of two functions to get the Like Status. I would suggest the following:
Function: Tumblr.LikeButton.get_status_by_post_ids([n,n,n])
Description: Request Like status for individual posts. Takes an array of post IDs
Once the ajax request is successful , we should have a data object (containing new posts, etc).
We need to create an array of postIDs, which is an array containing an ID / number for each post in the data object. Easiest way to add the the post id is to use the theme variable {PostID}.
Example
HTML
<article class="post" id="{PostID}">...</article>
jQuery Post IDs Array
var $newPosts = $(data).find('.post');
var $newPostIDs = $newPosts.map(function () {
return $(this).attr('id');
}).get();
Tumblr.LikeButton
Tumblr.LikeButton.get_status_by_post_ids($newPostIDs);
Hints
Create the array and call Tumblr.LikeButton once the ajax request is successful and in a place where you run other functions for the new Posts. This can also be done with pure javascript as using: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map