This is my code: else {// "image" is the default if (modRewrite) { path = webPath+"/"+albumUrl+"/"+imageUrl } else { path = webPath+"/albums/"+albumUrl+"/"+imageUrl } imageHTML += path; } Code (markup): The link that is generated looks like this: <a href="http://www.domain.com/albums/cars/ferrari.jpg"/> Code (markup): How can I add rel="lightbox" to the coding? I tried: path = webPath+"/albums/"+albumUrl+"/"+imageUrl+" rel="lightbox" Code (markup): but I get this generated: <a href="http://www.domain.com/albums/cars/ferrari.jpg%20rel="lightbox.jpg""/> Code (markup): but I need it to have the space for it to work. so it would look like <a href="http://www.domain.com/albums/cars/ferrari.jpg" rel="lightbox"> Code (markup): How can I do this? Sorry I have no knowledge of java at all. Thanks in advanced. [update] resolved
Sorry, Here's the full code that is related to this function: /** * Class declaration */ function ZenpressPopup() { }; /** * Insert an image in the text editor * @param imageId Id of the image (not used yet) * @param imageUrl Filename of the image * @param imageName Name (title) of the image */ ZenpressPopup.prototype.insertImage = function(imageId,imageUrl,imageName) { form = this.getEl('options'); whatValue = this.getRadioValue(form.what); linkValue = this.getRadioValue(form.link); closeValue = this.getRadioValue(form.close); wrapValue = this.getRadioValue(form.wrap); sizeValue = this.getRadioValue(form.size); modRewrite = form.mod_rewrite.value; webPath = form.zp_web_path.value; albumUrl = form.album_url.value; albumName = form.album_name.value; customWidth = form.custom_width.value; customHeight = form.custom_height.value; imageHTML = ""; if (linkValue!="none") { imageHTML += '<a href="'; if (linkValue=="album") { if (modRewrite) { path = webPath+"/"+albumUrl; } else { path = webPath+"/index.php?album="+albumUrl; } imageHTML += path; } else if (linkValue=="custom" && form.link_custom_url.value!="") { imageHTML += form.link_custom_url.value; } else { // "image" is the default if (modRewrite) { path = webPath+"/"+albumUrl+"/"+imageUrl } else { path = webPath+"/index.php?album="+albumUrl+"&image="+imageUrl } imageHTML += path; } imageHTML += '">'; } if (whatValue=="title") { imageHTML += imageName; } else if (whatValue=="custom" && form.what_custom_text.value!="") { imageHTML += form.what_custom_text.value; } else if (whatValue=="album") { imageHTML += albumName; } else { // "thumb" is the default if (modRewrite && sizeValue!="custom") { // ZenPhoto's mod_rewrite does not support custom size! path = webPath+"/"+albumUrl+"/image/"; if (sizeValue!="full") { path += "thumb/" } path += imageUrl } else { path = webPath+"/zen/i.php?a="+albumUrl+"&i="+imageUrl; if (sizeValue!="full" && sizeValue!="custom") { path += "&s=thumb"; } else if (sizeValue=="custom") { path += "&w="+customWidth+"&h="+customHeight; } } imageStyle = ''; imageClass = 'ZenPress_thumb '; if (wrapValue!="none") { imageStyle += 'float:'+wrapValue+'; '; imageClass += 'ZenPress_'+wrapValue+' '; } styleAttr = ''; if (imageStyle!='') { styleAttr = 'style="'+imageStyle+'"'; } imageHTML += '<img class="'+imageClass+'" alt="'+imageName+'" title="'+imageName+'" src="'+path+'" '+styleAttr+' />'; } if (linkValue!="none") { imageHTML += '</a>'; } if(window.tinyMCE) { window.opener.tinyMCE.execCommand("mceInsertContent",true,imageHTML); } else { this.insertAtCursor(window.opener.document.forms["post"].elements["content"],imageHTML); } if (closeValue!="false") { window.close(); } } Code (markup):
IMHO you're trying to make a wrong url. Instead of <a href="http://www.domain.com/albums/cars/ferrari.jpg rel="lightbox"/> You should try to make this: <a href="http://www.domain.com/albums/cars/ferrari.jpg" rel="lightbox"/> You can go here for syntax of the LINK <a> element: http://www.w3.org/TR/html401/struct/links.html#edef-LINK
You are right, I got sloppy with the syntax. But I still wouldn't know how to do it. I have no knowledge in any programming. I'm just trying to modify a wordpress plugin to do what I want it to.
Here you go, use the following code, it it shud work /** * Class declaration */ function ZenpressPopup() { }; /** * Insert an image in the text editor * @param imageId Id of the image (not used yet) * @param imageUrl Filename of the image * @param imageName Name (title) of the image */ ZenpressPopup.prototype.insertImage = function(imageId,imageUrl,imageName) { form = this.getEl('options'); whatValue = this.getRadioValue(form.what); linkValue = this.getRadioValue(form.link); closeValue = this.getRadioValue(form.close); wrapValue = this.getRadioValue(form.wrap); sizeValue = this.getRadioValue(form.size); modRewrite = form.mod_rewrite.value; webPath = form.zp_web_path.value; albumUrl = form.album_url.value; albumName = form.album_name.value; customWidth = form.custom_width.value; customHeight = form.custom_height.value; imageHTML = ""; if (linkValue!="none") { imageHTML += '<a rel="lightbox" href="'; if (linkValue=="album") { if (modRewrite) { path = webPath+"/"+albumUrl; } else { path = webPath+"/index.php?album="+albumUrl; } imageHTML += path; } else if (linkValue=="custom" && form.link_custom_url.value!="") { imageHTML += form.link_custom_url.value; } else { // "image" is the default if (modRewrite) { path = webPath+"/"+albumUrl+"/"+imageUrl } else { path = webPath+"/index.php?album="+albumUrl+"&image="+imageUrl } imageHTML += path; } imageHTML += '">'; } if (whatValue=="title") { imageHTML += imageName; } else if (whatValue=="custom" && form.what_custom_text.value!="") { imageHTML += form.what_custom_text.value; } else if (whatValue=="album") { imageHTML += albumName; } else { // "thumb" is the default if (modRewrite && sizeValue!="custom") { // ZenPhoto's mod_rewrite does not support custom size! path = webPath+"/"+albumUrl+"/image/"; if (sizeValue!="full") { path += "thumb/" } path += imageUrl } else { path = webPath+"/zen/i.php?a="+albumUrl+"&i="+imageUrl; if (sizeValue!="full" && sizeValue!="custom") { path += "&s=thumb"; } else if (sizeValue=="custom") { path += "&w="+customWidth+"&h="+customHeight; } } imageStyle = ''; imageClass = 'ZenPress_thumb '; if (wrapValue!="none") { imageStyle += 'float:'+wrapValue+'; '; imageClass += 'ZenPress_'+wrapValue+' '; } styleAttr = ''; if (imageStyle!='') { styleAttr = 'style="'+imageStyle+'"'; } imageHTML += '<img class="'+imageClass+'" alt="'+imageName+'" title="'+imageName+'" src="'+path+'" '+styleAttr+' />'; } if (linkValue!="none") { imageHTML += '</a>'; } if(window.tinyMCE) { window.opener.tinyMCE.execCommand("mceInsertContent",true,imageHTML); } else { this.insertAtCursor(window.opener.document.forms["post"].elements["content"],imageHTML); } if (closeValue!="false") { window.close(); } } Code (markup):