Displaying user website link in view - asp.net-mvc

Is this fine or is there a different way?
<%=Html.Encode(Model.Website??"")%>

Seems fine to me, although you might want to check that the website doesn't already start with "http://" as well.

You could write a custom HTML Helper to do it for you.

Related

How to print .docx,doc,xls,csv in rails 4?

How can I print .docx,doc,xls,csv in rails 4?
I tried window.open and window.print using javascript, but each time when it invokes window.open it downloads the file.
I tried to embed that in an iframe, that also fails.
Displaying a specific type of file isn't something that relies on your application it relies on the browser. In common browsers there is no support to display the file formats you mentioned.
What you can do is implementing some document viewers based on js if they are available for your usage. For example I know there is a plugin viewer.js that provides functionality to convert office and pdf to html. That might help you out... https://developers.box.com/viewer-js-tutorial/
I tried doing this some time back and this is the blog which i refereed. Helped a great deal.
Hope this helps.

Solution for the URL Alias and question marks issue in drupal 7

I am working in drupal 7 for developing site. I am using webform for creating a contact us form. After submitting the from successfully, the page is redirected to a confirmation page where the url is http://www.somesite.com/node/11/done?sid=3. I want this particular url as http://www.somesite.com/thankyou.
I tried to set the url alias for node/11/done?sid=% as thankyou. But unfortunately it doesn't work for me.
Can anybody suggest a solution for this..
Thanks in advance...
Are you saying the URL alias for that node won't change? Can you change others?

How to open a popup using Ajax

I'm using Ruby on Rails 2.3.8 and I would like to know how to open a popup using Ajax, instead of jQuery, so when I click in the link that will open it, an action is executed to load some collections and other stuff.
Thanks in advance!
First i think you are messing up some concepts here.
JQuery is a javascript framework and AJAX is a set of development methods.
See: http://en.wikipedia.org/wiki/Ajax_%28programming%29
and: http://en.wikipedia.org/wiki/Jquery
I think that you mean "How do i open a link in a lightbox like screen instead of a javascript popup".
(correct me if im wrong interpreting your question :)
Please take a look at some open source tools like:
http://chriswanstrath.com/facebox/
http://fancybox.net/
And there are tons and tons of other alternatives.
Just google for "lightbox"

PHP new page in same file?

I'm working on a PHP project and I need some help. I need to work with one php file and have multiple links on that php page. If a user clicks on one it will show phpinfo(); for example.
So how can I have a link on that one php page that shows that instead of what is usually shown?
Very basic example:
phpinfo
<?php
if($_GET['page']=='phpinfo'){
phpinfo();
}
?>
Use a URL query parameter. Something like /mypage.html&showphpinfo=true
At the beginning of your php file, check for that parameter, and if it exists, show the output of phpinfo() instead of doing everything else.
What you are looking for cannot be done by PHP alone.
due to these two comment:
Do you want to do this without reloading the page? – Hailwood
Yes. I just want it to hide everything else and show phpinfo – AustinM
It sounds like you are looking for is Ajax.
If so you might want to get friendly with a javascript framework such as jQuery.
Check out this link for information on using jQuery's built in Ajax functionality.

CodeIgniter URL

Sorry, but something weird is happening to me. I thought I should share.
Everything works fine in my CodeIgniter install doing local development, but I noticed that if I for example clicked on a link with the value of href being “controller/function” everything works fine. If I try to navigate to another page (essentially to another function inside my controller, say “controller/function1”, my CodeIgniter stacks the URL. The following is an example of what it does!
http://localhost/wayefoundation/index.php/mainpage/mainpage/programs
I was checking the community and only CodeIgniter 1.5.3 was mentioned to have some sort of bug even though I believe to check myself as well. What is happening to the URL above?
I figured it out. Sorry about the link, but I had to use site_url(). All the links were fine. I did not have a case of "accumulated links" in my address bar. So I did this for all my hrefs,
site_url("controller/method")

Resources