ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

help with url variable

August 31, 2010 11:14am

Subscribe [3]
  • #1 / Aug 31, 2010 11:14am

    robbiepost

    32 posts

    I’m trying to place a button with a link as an embed in a page. Works all well, the button is there and as long as I use an absolute href in the embeded page the button links nicely to whatever href given. Using EE 1.6.9

    However I want the href to be given as a variable. As soon as I’m doing that the link doesn’t work anymore and the page renders the url twice. This is the code in the embed document, where simpel_subtitel is the variable for the url.

    <div id="buttons" class="append-bottom">
        ../../resources/img/decowhite.png                    
        <hgroup class="aside">
        {exp:weblog:entries weblog="button" limit="1" status="Open" dynamic="off"}        
        {simpel_tekst}
        <a href="http://{simpel_subtitel}%22class=%22button" class="button medium green ">{title}</a>
        {/exp:weblog:entries}
    </div>

    The embed relation in the final document looks like this:

    <div id="content" class="container normalbackground">
                    <aside class="span-8">
                                    
                    <!-- sidenav elementen worden per pagina geselecteerd -->
                    
                        {embed="embed/_sidenav"}
                        
                        {exp:weblog:entries weblog="firstlevel" limit="1" status="Open"}
                                                
                            {if {side_selection:selected option="Adres"}}
                            {embed="embed/_address"}
                            {/if}
                            {if {side_selection:selected option="Googlemap"}}
                            {embed="embed/_googlemaps"}
                            {/if}
                            {if {side_selection:selected option="Testimonial"}}
                            {embed="embed/_testimonial"}
                            {/if}
                            {if {side_selection:selected option="Video"}}
                            {embed="embed/_video"}
                            {/if}
                            {if {side_selection:selected option="Advertentie"}}
                            {embed="embed/_advert"}
                            {/if}
                            {if {side_selection:selected option="Fotos"}}
                            {embed="embed/_fotos"}
                            {/if}    
                            {if {side_selection:selected option="Nieuws"}}
                            {embed="embed/_nieuws"}
                            {/if}                                                        
                            {if {side_selection:selected option="Freepass"}}
                            {embed="embed/_freepass"}
                            {/if}    
                            {if {side_selection:selected option="Button"}}
                            {embed="embed/_button"}
                            {/if}                                    
                    
                    <!-- end sidenav elementen -->

    Any glue?

  • #2 / Aug 31, 2010 5:18pm

    Ingmar

    29245 posts

    You cannot split your tags like this. An open {exp:weblog:entries} tag can’t be closed by a tag in a sub-template, and they shouldn’t be nested, either. What is {simpel_subtitel}, a global variable?

  • #3 / Aug 31, 2010 6:55pm

    robbiepost

    32 posts

    {simpel_subtitel} is a custom field in the “button” weblog holding the URL.

  • #4 / Sep 01, 2010 9:07am

    Ingmar

    29245 posts

    Please try to simplify your template as much as possible. In your example code you are separating opening and closing tags. Perhaps you should get it to run without any embeds first? Does that work?

  • #5 / Sep 02, 2010 5:15am

    robbiepost

    32 posts

    Communicating in a different then my native language is always difficult so let me rephrase the question (and perhaps make it a bit easier to understand). I noticed a similar issue on another part of the site. This is the code:

    <div id="video">
        {exp:weblog:entries weblog="video" limit="1" status="Open" dynamic="off" orderby="random"}                        
        ../../resources/img/decowhite.png
            <hgroup class="aside">
                <h2 >Kom binnen</h2>
                <h3 class="h3lijn">en bekijk de video van ons centrum</h3>
            </hgroup>
        <video controls width=260 height=150 poster="{video_poster}">
            <source src="{video_xml}" type=""></source>
             Deze browser ondersteund HTML5 video niet
        </video>
        {/exp:weblog:entries}                    
    </div>

    At the line “source” there is the custom field type {video_xml}. This field type contains the following link: http://perico.slideshowpro.com/albums/011/998/album-126195/lg/SPINNING.mp4 stored in a text input field with no formatting option.

    Now as soon as I render the page it returns this:

    <source src="<a href="http://perico.slideshowpro.com/albums/011/998/album-126195/lg/SPINNING.mp4">http://perico.slideshowpro.com/albums/011/998/album-126195/lg/SPINNING.mp4</a>" type=""></source>

    Obviously the link is not working as it should return this:

    <source src="http://perico.slideshowpro.com/albums/011/998/album-126195/lg/SPINNING.mp4" type=""</source>

    What am I doing wrong?

  • #6 / Sep 02, 2010 5:52am

    robbiepost

    32 posts

    Ingmar,

    Solved the issue myself. I was not aware of the option: “Automatically turn URLs and email addresses into links” in the weblog preferences was set by default to “yes”.

    Thanks anyway..

  • #7 / Sep 02, 2010 10:47am

    Sue Crocker

    26054 posts

    Glad you were able to figure out what the problem was. Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases