Drupal Custom Module Results to 404 - drupal-7

I'm having a really weird error right now. This was working fine a moment ago, but now when I access the url it gives the 404 error "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."
Here is my custom url
$items['timefie/obj/list/%'] = array(
'title' => t('List Record'),
'page arguments' => array(3),
'page callback' => 'timefie_record_list',
'access arguments' => array(2,3),
'access callback' => 'timefie_user_access',
'type' => MENU_CALLBACK // PLS IGNORE THIS LINE, I WAS DEBUGGING THEN
);
I have cleared my cache already many times to no avail.
I have also back-tracked my last few movements to try put them back on their previous configuration namely (logintobbogan, site information).
Another pointer, I tried to create a Menu links of this URL in admin/structure/menu/item and it seems it accepts it as valid but he is not validating the last URL argument '%' see second picture...

This 404 error is not from Drupal it's from your apache server, so i recommend that you check that you have clean URLs enabled also it will be a good idea to create a virtual host for your site because i think localhos/timefie is causing problems for you. then try again if you still have the same error check the page that redirected you to this page as there could be a broken link or check the callback function.

The requested URL "localhost/timefie/timefie/obj/list/transaction" is not found because there is some issue related to local host configuration. The URL should be "localhost/timefie/obj/list/transaction".

Thank you everyone for your effort, I ended up re-installing my apache and php, and found a tutorial to properly setup it in Multiple Virtual Hosts. I'm new to ubuntu so it takes a lot of effort for me to understand whats going on whenever theres an error. Thaks again.

Related

Show button when clicked on a element on cake php

Hello community i want to show a button when a ad was clicked (identify using class) and opened for at least 30s in cake php
button code
<?= $this->Form->button(__('Click here to continue'), [
'class' => 'btn btn-primary btn-captcha',
'id' => 'invisibleCaptchaShortlink',
]); ?>
And class = anything i will put the class by finding the class from ads.
If the user closed tab until 30 seconds ends the user should be redirect to the same url where the user is ,like g.com/fhgsd not the ad url and also button will not appear
Depends on how you are showing the ads, you are not providing much information to work with, to be honest. In order to use ads for cake you need either a plugin or an API. I don't know much about plugins, because even If there are good ones, chances are they are no longer supported or developed.
To do it with an API: You have to read the documentation about the API from the site that shows the advertisements (Site you work with). They should be the ones handling it and sending you back data about how much the user has looked at the ad and what not.
Then you get a response back, and you can read the values in cakePHP and work with them.
I recommend using this program to test out the API responses and requests, then you can use HTTP Client for cake to convert those responses to PHP code. It can be rough, but once you find out how it really works, it gets easier.

Page not found after redirect from other site with parameters

I am trying to get a redirect working from site a to site b with a parameter in the url. For example, I want to go from example.com to mysite.com?code=abc
When doing so, I get a 404 error. The page could not be found. When I manually browse to mysite.com?code=abc , it does get found. Does anyone know what causes this issue? All help is greatly appreciated.
Seems like it's just Intellij which doesn't support this. I tried with another site and it turned out fine.

links not pointing to the right place

So im trying to build a link using cakephp, here is the code im using:
echo $this->Html->link('FAQs',array('controller' => 'faqs','action' => 'index','full_base' => false));
and the link path im getting back is:
http://mysite.co.uk/websites/123reg/LinuxPackage25/ho/me/tr/mysite.co.uk/public_html/faqs
Im using a linux based hosting.
Has anyone experienced this before? or is able to offer some help.
thanks
First of all the problem isn't related to your use of full_base as it defaults to false anyway and should give you:
/faqs
The issue you seem to be having is that http://mysite.co.uk/ is not pointing to the root directory public_html. If you have acccess cPanel i.e. have login credentials for accessing your webhosting and root SSH access, have a look at this blog post and scroll down to Changing Primary domains:
http://blog.servint.net/2012/03/30/the-tech-bench-changing-a-document-root-in-cpanel/

CakePHP 1.3 Media view not downloading ZIP file correctly

I recently migrated my site from CakePHP 1.1 to 1.3.
I am now using media view to download files, however, I have a major problem.
When I download a zip file through media view, and try to extract it, windows claims the file is empty. If I try to preview it, it says it is invalid.
The file size is correct, same size as on server
I can download the exact same file from the server via FTP, and it is correct
I can download a pdf file through media view, and IT works correctly (but ZIP files do not)
Here's my controller code:
$this->view = 'Media';
$downloadparams = array(
'id' => 'junkstuff'.'.zip',
'name' => 'junk3',
'download' => true,
'extension' => 'zip', // must be lower case
'path' => APP . 'tmp/files' . DS // don't forget terminal 'DS'
);
$this->set($downloadparams);
Again, if I change to a pdf file, and change 'extension' to 'pdf', it all works correctly.
Debug is set to 0.
My code usage is straight from the 1.3 Cakebook: http://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/Views.html
Funny enough, they use zip as an example in the cakebook ....
What might I be doing wrong?
For reference, this thread appears to be the exact same issue, but it has no answers either:
when opened with winrar, Zip file obtained through Cakephp MediaViews reports Unexpected end of archive
Your content type might be wrong (which happens when not using the reponse class - which you cannot do in 1.3 of course):
Content-Type application/octet-stream
Should better be
Content-Type application/x-compressed
Also the content length might be useful.
You can try to add those headers manually using header().
It turns out that when I put the site live on the live server (it was on a server, but my "test" server), this problem fixed itself. The only thing I can think of it that somewhere there was a reference or a security check that referenced the official site name. My test site had a different site address.
That's a guess. I'm really not sure what it fixed itself. But I didn't change the code, and it started working on the live site.

CakePHP 2 - Facebook integration

Trying to add Facebook login / registration to a site I'm working on.
Been following this tutorial http://www.startutorial.com/articles/view/34
After some tweaking (because I'm on CakePHP 2, while the tutorial is for 1.3), I managed to get it to run. (Basically I just need to pull the plugin from the branch)
Now, I'm having issues with 2 things:
How do I save the information? Right now, after I login, I just come back to the same page but instead of the Login button, it says "Teepusink is using ThisApp"
Also some of the documentation doesn't seem to match with the branch version. For example,
Facebook->registration(); ?>
is giving me an error. Should I even be using the branch version? Or how do I go about using the plugin for CakePHP 2?
Thank you,
Tee
Got this to work actually.
So I went into ConnectComponent.php, and noticed that somehow the User model isn't being "recognized" there.
Took a little digging, but this is what I did.
'Facebook.Connect' => array('model' => 'User')
Hope this helps someone.

Resources