I encountered a small problem about the urls in Laravel 4, I created a route with the username variable whose value may contain points(dots). here is the example:
localhost:8888/users/joe.doe
the problem is that it always shows me the error 404
is there a way to activate the point in url?
Route::get('{username}', function() {
return $username;
});
Thanks a lot.
You could have a look at http://laravel.com/docs/routing#route-parameters - and apply a reguler route constraint.
Related
Problem Statement: To auto-populate the lookup field I use durable Id assignment with name. For e.g. https://sales--dev.my.salesforce.com/m2p/e?CF00N0l0000051XXX=Contract-00000XXX&inline=1
Notice this -> CF00N0l0000051XXX=Contract-00000XXX ~ durableId=recordName In url.
Now, when the user clicks the New button to create a record on the VF page above URL is loaded in classic and populates the Name in lookup like this
Trying to solve: In lightning, URL is getting overridden by this URL
https://sales--dev.lightning.force.com/lightning/o/objectName/new?count=2 Is there a way to achieve the same URL in lightning?
Do you really need it to be an URL hack? Can'y your thing be a quick action? The url prepopulation would be more reliable there and work everywhere.
URL hacking in lightning is bit simpler, you use field API names instead of IDs. These are decent tutorial: https://www.salesforceben.com/salesforce-url-hacking-for-lightning-tutorial/, https://sfdcdevelopers.com/2020/02/26/url-trick-in-salesforce-lightning/
So, how do you know where you are, in Classic or LEX. Which URL to use? Have a look at UiThemeDisplayed variable, available in Visualforce and in Apex's UserInfo class.
IF($User.UIThemeDisplayed == 'Theme4d' || $User.UIThemeDisplayed == 'Theme4t' || $User.UIThemeDisplayed == 'Theme4u',
'link for lightning',
'link for classic'
)
Working approach:
Created a controller for VF page:
global PageReference newParty() {
PageReference pageRef;
pageRef = new PageReference('/lightning/o/Party/new?defaultFieldValues=Contract='+contractID);
return pageRef
You can absolutely do this with a button / URL hack in lightning with the Spring '20 release. The URL can use "defaultFieldValues="
https://www.salesforceben.com/salesforce-url-hacking-for-lightning-tutorial/
I'm a Silex newbie and I'd like to redirect the '/' url to the default language like '/en' for example. I do this :
$app->match('/', function(Application $app){
return $app->redirect('/Silex/www/'.$app['locale_fallbacks'][0]);
});
Am I constrained to put the absolute url from the root of the server ? I'd like to put only $app->redirect('$app['locale_fallbacks'][0]);. And is it the right way to get the default language ?
Thanks a lot
You do not have to give the host there. As in your match() you will pass a relative url. However it would probably be better not to make a new roundtrip to the browser and to forward the request internally or even rewrite it via .htaccess.
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
$app->match('/', function () use ($app) {
$subRequest = Request::create('/' . $app['locale_fallbacks'][0], 'GET');
return $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
});
Currently I have
http://www.example.com/videos/videoId
In my iron router,
Router.route('/videos/:_id', { name: 'videoShowtemplate' }
I want to make my site more seo friendly so I was thinking of adding
the video title to the URL.
http://www.example.com/videos/videoId/videoTitle
can you tell me how i can do this? thank you very much in advance.
Go through the docs: https://github.com/EventedMind/iron-router/blob/devel/Guide.md
Keep the same route and just add /:slug to your params.
Do all your validations on _id
Router.route('/videos/:_id/:slug', {
template: 'videoShowtemplate'
}
use the following code to redirect to the site
in html
click here
or in js
Router.go('videoShowtemplate', {_id: id,slug: title});
Suppose this is my URL:
https://stackoverflow.com/questions/ask/question1.xml
Currently in my UrlMappings.groovy I have `
"/$Question/$ask/$question1"(controller:"somecontroller")` to handle the request.
If my URL changes to:
https://stackoverflow.com/questions/ask/askAgain/question1.xml
my URL mapping cannot handle it.
Is there a way I can get ask/askAgain to be referenced by $ask in my urlmapping.groovy?
This is what I did to get around this.
I changed my URLMapping to
"/$Question/$ask**"(controller:"somecontroller")
If my URL is :
`http://stackoverflow.com/questions/ask/askAgain/question1.xml`
So now, $ask** = ask/askAgain/question1.xml
Then, If I want to remove question1.xml from that URL. I can use Regex to get rid of it.
You will have to provide 2 mappings:
"/$Question/$ask/$question1"(controller: "somecontroller")
"/$Question/$ask/$askAgain/$question1"(controller: "somecontroller")
I am really scratching my head over this one. I am using cloudant as my couchdb provider and attempting to save a document to my db. I first establish what my db is in the following code.
db = jQuery.couch.db("https://fullscore.cloudant.com/fullscore");
I do a console.log and see that the URI and name are correct in the object.
db.saveDoc(doc, {
success: function(data) {
console.log("posted");
},
error: function(status) {
console.log("failure");
}
});
However when I look at the post, it posts to: https://cloudant.com/https%3A%2F%2Ffullscore.cloudant.com%2Ffullscore/
Which as you can see is totally wrong. Obviously there is something built in to append onto cloudant.com ... anyone know how this can be overridden? Or perhaps its some other problem? I'm getting a 404 error.
--Ashley
To clarify the exact code, you need to set the URL prefix on your couch object, then use just the db name:
$.couch.urlPrefix = "https://username.cloudant.com";
var db = $.couch.db("dbname");
I'm guessing you're passing the full database URL in a place where you're only supposed to pass the database name (i.e. the latter "fullscore" part in https://fullscore.cloudant.com/fullscore"). You've probably already set up the host name at some earlier point in your program.