Eunico Cornelius
Members-
Posts
11 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Eunico Cornelius's Achievements
Jr. Member (3/6)
3
Reputation
-
selector Per-word $selector for autocomplete search bar
Eunico Cornelius replied to Eunico Cornelius's topic in API & Templates
I understand this part, and I have tried to do it with body^=$q, However in a search, this will only apply for the first part of the word. For example, if I have a question "What is the best pet" this will only work if I search for "wh" and it will not show if I even search for "best". I have read the documentation and body*=$q fits more for search queries. Thank you for you help . @DaveP @LostKobrakai -
I am trying to filter my $pages with a find($selector method). $matches = $pages->find($selector); and this is an example of what my selector looks like $selector = "include=all, title|body~=$q, limit=50"; In this case, it only searches according to the matching exact words. For example:we search="art", the result="art times","these art",.... Is there any way to search based on the alphabet? For example: we search="ab", the result="absolutely correct","abstract art",....
-
json Plain JSON PHP file in a template with ProCache
Eunico Cornelius replied to Eunico Cornelius's topic in API & Templates
The solution: Just need to disable the appending main page from the template. Thanks for your help @psy -
json Plain JSON PHP file in a template with ProCache
Eunico Cornelius posted a topic in API & Templates
Hi, I am trying to create a PHP page in my website that is hidden and produce a plain JSON format. However, when I implement json_encode on my string, the result is not only a plain JSON but also a <!DOCTYPE HTML>.... I have created a new page and a new template that has it's cache disabled, but it still doesn't work. this is what my code looks like <?PHP $useMain=false; $data = "[{'title':'AAAAA','url':'https://google.com'}]"; header('Content-Type: application/json'); echo json_encode($data); ?> This is what I currently get "[{'title':'AAAAA','url':'https:\/\/google.com'}]"<!DOCTYPE html><html>....</html> This is what I am trying to achieve "[{'title':'AAAAA','url':'https:\/\/google.com'}]" What am I missing here? I am also using ProCache.(dont know if it has any influence since I created and disable cache in a new template) -
Here is the answer I've been searching for <?php foreach ($page->files as $file) { echo "<a href='{$file->url}' download>download {$file->name}</a><br>"; } ?> Thank you for the help
-
I've seen this tutorial. However, I am trying to download the file by only using href="" and not tweaking _init.php. Let's say for example the file I have uploaded to the page is called sample.pdf . what would be the href parameter to download the file from the page? I tried this foreach ($page->files as $file) { echo "<a href='{$page->files->url}' download>download {$file->name}</a><br>"; } but it gives me a 403 error. Sorry I am new to this kind of thing. Help anyone?
-
Hi, I am trying to make a download button using <a href="$page->files->sample.pdf" download>download</a>. What am I doing wrong here?
-
I'm sorry I forgot to mention that what I used as the first parameter is from the array $formats = $datetime->getDateFormats(); which when implemented, will look like this $dateformat = $datetime->convertDateFormat($formats[4], 'strftime'); why is it not doable to get the format from the list?
- 4 replies
-
- format
- converdateformat
-
(and 1 more)
Tagged with:
-
I am trying to get the strftime format from the function convertDateFormat(). However, the output has $ signs in it which i cannot use in strftime.(example of conversion : $d/$m/%Y what strftime actually uses: %d/%m/%Y). Am I in the wrong here or is there some way to format strftime? Thank you in advance :).
- 4 replies
-
- 1
-
- format
- converdateformat
-
(and 1 more)
Tagged with:
-
datetime DateTime format according to user language
Eunico Cornelius replied to Eunico Cornelius's topic in API & Templates
I am not using fields currently, is there any way to do this without fields or maybe code wise? -
datetime DateTime format according to user language
Eunico Cornelius posted a topic in API & Templates
Hi, I am new to process wire and I've been trying to change the date time format in my webpage according to its language selection(example: English 'd/m/y' , Deutsch: 'd.m.y'). I know that using $datetime->getDateFormats(); we can achieve the type of formats in the shape of indexes. Also, by using $user->language->id we can know which language we are using. How do I combine this two functions so that when I select English/Deutsch, the date will be adjusted accordingly? Is there a specific function that can do this or is there any provided index in the $user->language somewhere. Thanks in advance :).