I am trying to make a custom frame that turns the whole content element into a single button using the destination set in the Header link field.
tt_content.stdWrap.innerWrap.cObject {
100 = TEXT
100.value = <a id="c{field:uid}" class="myclass" href="{field:header_link}">|</a>
100.insertData = 1
}
It doesn't work because the header is still linked making a link within a link. Is there a way to disable the link on the header so I can link the whole thing instead?
Related
I am trying to make an "Infobox" with TYPO3.
In my HTML Template i have the Infobox:
<div id="infobox">
<!-- ###infobox### start -->
CONTENT from the backend
<!-- ###infobox### start -->
</div>
...
Now in my Backend, i have a content element, that keeps the content for my Infobox in the Frontend:
What i want to do is: If i disable the content element via the "disable button" in the backend, i want to change the CSS of my #infobox (adding display:none) or if I re-enable it I want to remove the display:none.
I hope I could explain my issue and hope someone can help me.
As far as I understand, you want the disabled flag of the content element to only influence the rendered output, not switch off the rendering.
I fear that this is not easily possible. The disabled column is part of TYPO3’s so-called enable fields, for which checks are added all over the place by the TYPO3 API. Due to this, "hidden" records are usually not even selected from the database, so they are also never fed to the rendering engine.
An alternative would be to use a custom content type with a custom field for your purpose, hide the "hidden" field in the form for that type and put the custom field in its place. This can all be done with standard TYPO3 core mechanisms.
What you cannot avoid however is that somebody will be able to hide/disable the content element from the page or list module. This cannot be prevented as your content needs to live in the same table (tt_content) as the rest of the content—and the settings for enable fields are global per table.
You can use an custom fluid content element
see: http://www.creativeworkspace.de/blog/artikel/eigene-inhaltselemente-im-typo3-cms-62x-und-7x/
or: https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/7.6/AddingYourOwnContentElements/Index.html
or you use a custom layout
TCEFORM.tt_content {
layout {
addItems {
item1 = Name of Layout
}
}
}
after this you can get it with {data.layout} in your template
{f:if(contition:'{data.layout} == item1',then:'display:none')}
I'm using TYPO3 newsletter extension and I'm looking for a solution not to display the link to the web view again when the web view already is shown.
newsletter is an extension that makes it possible to send pages as an email. If the users clicks on the link in the email, a browser window opens with a web view of the newsletter. I want to avoid the redundant display of this link.
In my newsletter fluid template i've got the following line:
###:IF: newsletter_view_url ###<p>If this e-mail cannot be display correctly, please click here.###:ENDIF:###</p>
The placeholders are delivered exclusively by the extension, so they are - as you see - no typoscript vars. The problem is: newsletter_view_url is always filled with a value and also the other possible vars always take the same value in email view as well as in web view.
What i tried so far:
Assign some var to the fluid template to distinct the web view from the email view:
# Create a Fluid Template
page.10 = FLUIDTEMPLATE
page.10 {
# Set the Template Paths
partialRootPath = {$privateTemplatePath}Partials/
layoutRootPath = {$privateTemplatePath}Layouts/
variables {
controllerAction = TEXT
controllerAction.data = GP:tx_newsletter_p|action
}
}
and in the fluid template file:
<f:if condition="{controllerAction}"><p>If this e-mail cannot be display correctly, please click here.</p></f:if>
Problem: controller action does not take any value though it is set in the get-string while opening the url from the newsletter:
test.html?type=1342671779&tx_newsletter_p%5Bc%5D=a0648d94a22dd5928762b1bd5f82e9de&tx_newsletter_p%5Baction%5D=show& ...
It also does not work if i use controller action for a typoscript condition
controllerAction = TEXT
controllerAction.value = 1
[globalVar = GP:tx_newsletter_p|action = show]
controllerAction.value = 0
[global]
I would be very grateful for further inspirations! Thank you so much!
According to this feature request, it is not implemented yet:
https://github.com/Ecodev/newsletter/issues/19
I suggest contacting author and submitting pull request with this change. As of how to implement it, might be changing the PHP code to add custom parameter to the URL when viewing in browser which would hide any part of newsletter template.
I'm trying to create a GWT button that includes both an image and text like this:
I can create and set the button image like this:
PushButton button = new PushButton();
button.getUpFace().setImage(new Image(icon));
but if I do this the image disappears:
button.setText("ABC");
How can I keep both? I would prefer not to use the setHtml method because that would create a new HTTP request
EDIT: The problem with calling setHTML() is that it causes the browser to send another HTTP request to the server. This means that when I change the icon the button is blank for a second or two while the browser waits for a response from the server - obviously this not ideal. I'm looking for a way to use the image that is in memory in the form of a ImageResource object. Thanks!
There are lots of ways to achieve this.
Please have a look at below post asked in the same context:
HTML/CSS - Adding an Icon to a button
Adding icons to an button in gwt
GWT Custom Button with Icon above Text
Sample code:
Button button = new Button();
// get image form CSS resource
String url = new Image(Resources.INSTANCE.cut()).getUrl();
// get image from url
String url = "https://cdn3.iconfinder.com/data/icons/tango-icon-library/48/edit-cut-64.png";
// get image from the project war/images folder
String url = GWT.getHostPageBaseURL() + "images/cut.png";
String html = "<div><center><img src = '" + url
+ "'></img></center><label>Cut</label></br></div>";
button.setHTML(html);
Note: you can move it to CSS as well and append in HTML.
___________-
EDIT
You can achieve it using PushButton as well using setInnerHTML()method that will benefit from ImageResource as well.
final PushButton pushButton = new PushButton(new Image(Resources.INSTANCE.old_cut_icon()));
pushButton.getElement().setInnerHTML("<div><center>"+pushButton.getElement().getInnerHTML()+"</center><label><center>Cut</center></label></div>");
now simply call setImage() whenever needed to change the icon only.
pushButton.getUpFace().setImage(new Image(Resources.INSTANCE.new_cut_icon()));
Screenshot
Set a text on your button. Also set a CSS style:
.myButton {
background-image:url('/images/icon/cut.png');
background-position:center top;
padding: 28px 2px 2px;
}
Adjust padding depending on the size of your image.
An alternative approach is to create a widget that combines a button with a label, and either (1) put them in a LayoutPanel, specifying the position that you want, or (2) use CSS to move the label on top of the button (better).
Here is my goal: I want to click a specific link on one page, and on the page that loads, I want to change a specific class. I am aware of the onClick function, but not sure it can be used here. Is there a way to do this?
Thank you very much.
This jquery would do what you want:
$(document).ready(function(){
var anchor = '#myanchor';
if (window.location.href.indexOf(anchor) > 0) {
//do what you want here, change classes, etc
}
});
you should place this javascript on the second page, change #myanchor for your anchor used.
Make sure to include the jquery library in the second page for this to work.
I have a number of web views in my app in which I need to be careful about allowing further HTML links.
I disallow links in the delegate method shouldStartLoadWithRequest. This works fine, except for one thing. In the web view, the links are still highlighted in blue. So the user naturally thinks they are active links, but when selected, I disallow the link from the delegate method. This leads to confusion for the user.
Is there a way for me to disable the link color, so text does not show as blue when it contains a link within a UIWebView?
Try injecting Javascript into the UIWebView to change the appearance of the links.
Removing the href from all anchors should clear the formatting.
Here's some Javascript to get you started if you need it:
for(a in document.getElementsByTagName("a")) { a.href= ""; }
This will do it:
self.webView.dataDetectorTypes = UIDataDetectorTypeNone;
For swift 3:
Try removing the types you don't want to show as link from webView.dataDetectorTypes
webView.dataDetectorTypes.remove(UIDataDetectorTypes.all)