Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Adrian Alexa 50 posts 100 karma points
    Jan 06, 2012 @ 15:06
    Adrian Alexa
    0

    How to use variables in Umbraco

    I am very new beginner in umbraco. As I recieved a project made in umbraco I have to make some changes. I read something around but not found what I wanted.

    So I go to Content I have SiteName EN(it is a folder) which contains some pages. I click on a page which is called signup. On the right side appears content with 3 tabs. The selected tab is Content :) Good so far. Now I press edit html page.

    Here is just plain text in html.

    Question:

    How do I take variables values? How are they transmited? I want for example to take value of the host name. And according to that action value will take different values.

    Can you please give me some help?


    <form action="" type="POST">

    <input class="sign_up_link" name="SignUp" value="SIGN UP" type="submit" />

    </form>

    Q2: Should I open project with Visual Studio Developper to edit code or just from backend?

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 06, 2012 @ 17:04
    Jan Skovgaard
    0

    Hi Adrian

    It sounds to me like you're trying to edit HTML in the content section using in a rich text editor? This is not where you should place any programming logic at all. It's only for content like text, images etc. - no coding.

    However you can insert macroes into a richt text editor, which makes it possible to insert a form on the page.

    In order to guide you properly I would like to know if you're a backend developer with .NET, Razor and C# skills or if you're a frontend developer who can do XSLT/Razor?

    And what is it exactly that you need to get done? Should it be made for one site only or do you have multiple languages in the same installation, which you need to make a form that can be used in both languages etc.?

    /Jan

  • Adrian Alexa 50 posts 100 karma points
    Jan 06, 2012 @ 20:27
    Adrian Alexa
    0

    Hi, I am a dot.net developer. I know C#, basicaly programming :)

    It has to be done for 2 languages.

    Generaly i am interested how to include code in templates/contents. Maybe if you can redirect me to a tutorial that will lean me this it will be great.

    Thanks.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 06, 2012 @ 20:34
    Jan Skovgaard
    0

    Hi Adrian

    Then you probably want to learn how to use user control based macroes and Razor.

    I think Skiltz has made a good starting point with his blog series about user controls in Umbraco. You can read part 1 here: http://skiltzonnet.blogspot.com/2008/01/creating-you-first-umbraco-user-control.html

    In order to learn Razor (in Umbraco 4.7 - implementation in 5 is a bit different) you have have a look at the descriptions about it here: http://umbraco.com/follow-us/blog-archive/2011/2/23/umbraco-47-razor-feature-walkthrough-%E2%80%93-part-1.aspx

    There are also videos about it on Umbraco TV and some packages here on the forum you could have a look at.

    You should also be aware of dictionary items in Umbraco that allows you to translate labels etc. pretty easy in forms, since you just create an item pr. label you need to have multiple language versions of.

    I hope this helps you a bit further - please don't hesitate to ask further questions if you're in doubt about something :)

    /Jan

     

  • Adrian Alexa 50 posts 100 karma points
    Jan 09, 2012 @ 10:38
    Adrian Alexa
    0

    Thanks Jan for your answers. I am going to give you some more specific todos. I have a page where I need to place 4 buttons of Signup. There are 4 possibilites when a user sign up on our web application site. So that is why when user press a button need to be redirected to a link, a different than the site this button is going to be placed transmitting 2 parameters AccountType and maxNumber.

    So I tried to make a controlor

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SignUpButton.ascx.cs" Inherits="HoteloProModules.SignUpButton.SignUpButton" %>
    <form id="formSignUp" runat="server" action="">
        <asp:Button CssClass="sign_up_link" Text="SIGN UP" runat="server" ID="btnSignUp"/>
        <asp:HiddenField ID="hidMaxNrOfRooms" Value=""  runat="server"/>
    </form>

     

    namespace HoteloProModules.SignUpButton
    {
        public partial class SignUpButton : System.Web.UI.UserControl
        {
            private Int16 MaxNrOfRooms;//, AccountType;

            public Int16 _MaxNrOfRooms
            {
                get { return MaxNrOfRooms; }
                set { MaxNrOfRooms = value; }
            }
            //public Int16 _AccountType
            //{
            //    get { return AccountType; }
            //    set { AccountType = value; }
            //}
            protected void Page_Load(object sender, EventArgs e)
            {
              hidMaxNrOfRooms.Value = _MaxNrOfRooms.ToString();
            }
        }
    }

     

    As you can see from codes... I want from backend to insert this controler set those two parameters. Hidden values should take value from this 2 params. So when press the button they will be transmited.

    If I inserted them on a page it shows me

    SignUpButton
    No macro content available for WYSIWYG editing
    and  I see no result :|
    Can you tell me what to do or which is the best solution> Should Razor be?
Please Sign in or register to post replies

Write your reply to:

Draft