Jump to content

Eunico Cornelius

  • Posts

  • Joined

  • Last visited

Everything posted by Eunico Cornelius

  1. 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
  2. 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",....
  3. The solution: Just need to disable the appending main page from the template. Thanks for your help @psy
  4. 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)
  5. 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
  6. 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?
  7. 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?
  8. 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?
  9. 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 :).
  10. I am not using fields currently, is there any way to do this without fields or maybe code wise?
  11. 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 :).
  • Create New...