Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Everytime I want to change my url, I have to do at my database.
This is my code at index.ctp. I can't rename it at the web. I have to do at phpmyadmin.
<?php
echo $this->Form->input('Company.forum_url',
array('label'=>false , 'maxlength' => '10')
);
?>
Someone please help me.
If you mean you need to know the address of your website you can find it in the $_SERVER super global:
http://php.net/manual/en/reserved.variables.server.php
echo $_SERVER['SERVER_NAME']
CakePHP is more than happy to run in any directory/url without you having name your links specifically.
The HTML helper has a handy link() method that takes care of that for you:
echo $this->Html->link('link label', '/foo/bar/1');
or
echo $this->Html->link('link label', array('controller'=>'foos', 'action'=>'bar', 1));
will create a link that works irrespective of the host name or the url the link is being displayed on.
You can get the path to your applications web root with (useful for passing into javascripts):
$root = Router::url('/');
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am trying to display product details using javascript. I am using haml and RoR-4.2.1. I have the following code
var a = new Array();
#{#productlist.map do |prdct|
<<-EOS
var t = new Object();
t.product_id = '#{prdct.product_id}';
t.name = '#{prdct.name}';
t.address = '#{prdct.address}';
a.push(t)
EOS
end.join("\n")}
I have a model images which contains the images for the products. A product may or may not have images. So to display images I have added the following
t.shop_image =
"#{if prdct.images.present?
prdct.images.first.image_url
else
''
}"
statements before push statement. But it is generating an issue. How can I add if checking in the heredocs.
Approach 1: do the same thing you'd do with "normal" strings.
"#{product.images.present? ? product.images.first.image_url : ''}"
Approach 1+: extract the expression above into a variable, so that your template contains less logic.
Approach 2: don't abuse heredocs and use ERB instead.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have a JSON "string" (if that makes sense), which I am trying to bind to a table but it is not showing the items.
Here is a JS Fiddle showing what I mean.
http://jsbin.com/ziboh/17/edit
Is the reason for it not working because it is a JSON String and not a true JSON object.
JSONModel works with JSON data. If your data is in a string format you can use JSON.parse(your data text) but if possible try to keep your data in JSON format.
Please see http://jsbin.com/nuhijemape/2/edit
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
How can I play 20 wma files on delphi using Tmediaplayer, one after another in a continues loop until the program is closed ? I already tried using a timer for each file , but I keep failing. I have 20 songs that I'd like to play in the background while the rest of the program runs.
Put the filenames into a list. Set the TMediaPlayer.FileName property to the first filename in the list, set the TMediaPlayer.Notify property to true, and call TMediaPlayer.Play(). When the TMediaPlayer.OnNotify event signals playback has finished, you can assign the next filename in the list to TMediaPlayer.FileName, reset TMediaPlayer.Notify to true, and call TMediaPlayer.Play(). Repeat for each filename in the list. One you have played the last filename, start over with the first filename.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
hy
im making an app to help students study better but im having trouble. the app let you make notes between other things,but I need a code that can recognize specific characters in a text for example the user writes in a note "Dolphins : are cetacean mammals closely..." i need the app to recognize the character : and also the part thats on the left it needs to be save to use later, as a variable and the part of the right also but as a different variable so I can use them later.
if you can get me the code for that it be great but if possible i preferred a tutorial :)
(the app is for iPhone im using Xcode 5)
Something like:
NSArray *stringArray = [yourNSString componentsSeparatedByString:#":"];
NSString *leftString = stringArray[0];
NSString *rightString = stringArray[1];
EDIT: Just make sure string has the ":" character.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
x = {"utf8"=>"✓",
"authenticity_token"=>"xxxxxxxxxxxxx=",
"file"=>#>,
"unit_id"=>"00001"}
I have ruby data structure like this and um trying to get the value of #original_filename field
I tried something like this
x["#original_filename"]
and
x[:original_filename]
But both has thrown me an error . How to access that specified element value?
looks like you're trying to upload a file; from your tiny screenshot maybe you're referring to params[:file].original_filename?
The parameter ["file"] is a ActionDispatch::Http::UploadedFile, which has the original_filename member variable, as you can see in the params displayed in your image or here:
http://api.rubyonrails.org/classes/ActionDispatch/Http/UploadedFile.html
So, the way to get this value would be x["file"].original_filename