I need to have a functionality in my site like the facebook opens the the user's profile (i.e. www.facebook.com/avadhesh.mishra). I want to have url like www.mysite.com/username which will open the profile of my user,
For this I added the following line in my router file but it doesn't help anymore.
Router::connect('/*', array('controller' => 'users', 'action' => 'view_profile'));
Thanks in advance.
Write your code at the end of all the routs & make sure that your view_profile redirects to 404 page when the user not found.
Related
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.
We are getting "redirected you too many times" error after giving redirection. All inner pages are working properly but the home page is not working without login into the drupal admin side.
It seems once you are visiting home page, there could be any condition for redirect which is looping, that 's why you are getting this error,did you implement any custom module.also check your .htaccess file.
I'm now using specflow+selenium webdriver with unit test provider mstest to do automation test on multi browsers.
Currently, I have some scenarios and they can be executed on different browsers such as IE, Chrome and Firefox. In order to test 3 browsers I have to write the scenario 3 times each with a tag on it.
#ie
Scenario: IE Using valid user to login
Given I have navigated to the login page
And I type the 'username' and 'password'
When I click login button
Then I should see the home page
#chrome
Scenario: Chrome Using valid user to login
Given I have navigated to the login page
And I type the 'username' and 'password'
When I click login button
Then I should see the home page
#firefox
Scenario: Firefox Using valid user to login
Given I have navigated to the login page
And I type the 'username' and 'password'
When I click login button
Then I should see the home page
Now, the testcases are same only with different browser. There's too much redundant code. So I want to only write one Scenario with multi tags for different browser and let it generate 3 tests as below.
#ie
#chrome
#firefox
Scenario: Using valid user to login
Given I have navigated to the login page
And I type the 'username' and 'password'
When I click login button
Then I should see the home page
How can I do it? or is there any other solutions?
Thanks!
I am not sure if this is possible in plain MSTest.
But your usecase is one, why the SpecFlow+Runner was created.
Have a look at this example: https://github.com/techtalk/SpecFlow.Plus.Examples/tree/master/SeleniumWebTest
This implements your requirements by using the SpecFlow+Runner.
Full disclosure: I am one of the developers of SpecFlow+ (Runner/Excel).
create a excel sheet of test cases with you testdata of username and password and also mention in which browser you want to run, the you can write a script of fetching data from excel sheet, by writing it in switch case, can create case of different browsers.
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.
I currently have a form where you put in two variables and on submit it redirects to a url like this:
http://example.com/deal_user_coupons/check_qr/$var1/4var2
but when logged in as admin it goes to:
http://example.com/albuquerque/admin/deal_user_coupons/check_qr/$var1/$var2
Which makes it show a 404 page.
I was wondering how to get rid of the admin directory slash. I tried looking in the documentation and at a few acl tutorials but nothing came close.
You can redirect form on the exact page you need using url option.
$this->Form->create('Shutk',array('url'=>array('controller'=>'my_controller',
'action'=>'my_action',
'admin'=>false)
)
);
don't forget to use in url array. this will remove admin prefix from action attribute of the form.
'admin'=>false