I am scraping external website and using cfx_http5 tag to get data as cfhttp is very slow, so with cfx_http5, it does not do the resolveurl, with cfhttp it do the resolveurl so make the url point to same domain from where file is coming
now i need to use the cfx tag, but all my url's coming as:
with cfx_http5
<a href="details.cfm?acb=1>cick</a>
with cfhttp:
<a href="http://theddomain.com/details.cfm?acb=1>cick</a>
so how can i add a code in coldfusion to append this url to all the href tags
please guide
Try this:
<cfset httpResult = ReplaceNoCase(httpResult, '<a href="', '<a href="http://theddomain.com/', 'all')>
Related
I know this is an armature question but here goes.
I have a url path as follows:
path('projects/<s>', PL.projects),
And I pass a string from the html template by putting it into an href tag like so projects/some_string. this works once but then the base url changes to <ip>/projects/some_string. so when I try to excite the path to pass a string in that domain then I get an error as the url is now <ip>/projects/projects/some_string.
How do I set it up so that I can pass as many strings as possible as many times as possible without having to clean my url in the browser everytime.
Django has inbuilt url lookup features
path("some_random_url_link_1/", views.Link1View.as_view(), name="url_link_1"),
path("some_random_url_link_2/<int:some_id>/<slug:some_slug>/", views.Link2View.as_view(), name="url_link_2"),
in your template you can use it like this, and pass variables/parameters like this. FYI you don't need to use {{variable}} tag here
<a href="{% url 'url_link_1' %}" >Link 1</a>
<a href="{% url 'url_link_2' some_id=id1 some_slug=random_slug %}" >Link 2</a>
Learn how to use the reverse() function and the url template tag and your problems will be gone.
Those functions are built-in with Django and can handle all of that nasty URL stuff.
Reverse: https://docs.djangoproject.com/en/3.2/ref/urlresolvers/
Url Template tag: https://docs.djangoproject.com/en/3.2/ref/templates/builtins/#url
I am trying to redirect a new page by using tag in coldfusion page by using below code. I am able to get achor symbol,but it is not going to respective page.
Can any one help me on it.
<p class="login__signup">Don't have an account?
<cfoutput ><a herf="RegisterFrom.cfm">Sign up</a></cfoutput></p>
Thanks.
"herf" is not a valid anchor property. It should be "href".
I do a web crawling use scrapy. currently, it can extract the start url but not crawl later.
start_urls = ['https://cloud.cubecontentgovernance.com/retention/document_types.aspx']
allowed_domains = ['cubecontentgovernance.com']
rules = (
Rule(LinkExtractor(allow=("document_type_retention.aspx?dtid=1054456",)),
callback='parse_item', follow=True),
)
And the link i want to extract in the develop tool is:<a id="ctl00_body_ListView1_ctrl0_hyperNameLink" href="document_type_retention.aspx?dtid=1054456"> pricing </a>
the corresponding url is https://cloud.cubecontentgovernance.com/retention/document_type_retention.aspx?dtid=1054456
so what the allow field should be? thanks a lot
When I try to open the site of your start URL I get a login window.
Did you try to print response.body in the simple parse method for your start URL? I guess your Scrapy instance gets the same login window which does not have the URL you want to extract with the LinkExtractor.
I use the url template tag with named URLs all the time in Django but now I need to be able to pass query strings to a couple of URLs in a Django template. Is this possible to do? The url template tag documentation does not mention GET query strings at all and hardcoding in URLs is bad practice if you ever want to change the URL in the future you also need to change the templates.
Well, I do not quite understand but... I think you want something like this:
<a title="" href="{% url my_url %}?foo=bar&spam=eggs">My link</a>
I need to embed an issuu document inside a website. The website administrator should be allowed to decide which document is displayed on the frontend.
This is an easy task, using the embed link on the issuu page. But I need to customize some options - for instance, disable sharing, set the dimensions and so on. I cannot rely on the administrators doing this process every time they need to change the document.
I can easily customize the issuu embed code to my taste, and all that I need is the document id. Unfortunately, the id is not included in the issuu page for the document. For instance, the id for this random link happens to be 110209071155-d0ed1d10ac0b40dda80dad24166a76ee, which is nowhere to be found, neither in the URL nor easily inside the page. You have to dig into the embed code to find it.
I thought the issuu API could allow me to get a document id given its URL, but I cannot find anything like this. The closest match is the search API, but if I search for the exact name of the document I get only one match for a different document!
Is there some easy way to be able to embed a document only knowing its URL? Or an easy way for a non techie person to find a document id in the page?
Unfortunate the only way for you to costomize is to pay for the service wich is 39$ for month =/.
You can force a fullscreen mode without ads by using
<body style="margin:0px;padding:0px;overflow:hidden">
<iframe src="YOUR ISSU EMBED" frameborder="0" style="overflow:hidden;height:105%;width:105%;position:absolute;" height="100%" width="100%""></iframe>
</body>
You can embed of course stacks but that isnt showed on Issuu site. This is code (its old code but it works):
<iframe src="http://static.issuu.com/widgets/shelf/index.html?folderId=FOLDERIDamp;theme=theme1&rows=1&thumbSize=large&roundedCorners=true&showTitle=true&showAuthor=false&shadow=true&effect3d=true" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="100%" height="200"></iframe>
FOLDERID is number of 36 chars that you get on address bar when you enter stacks (example: https://issuu.com/username/stacks/FOLDERID). When you replacing that in code you must paste 36 chars in this format 8-4-4-4-12 with - between chars. And voila its working.
You can change theme and other stuffs in code.
The Document ID is found in the HTML source of every document. It is in the og:video meta property.
<meta property="og:video" content="http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf?mode=mini&documentId=XXXXXXXX-XXXXXXXXXXXXX&pageNumber=0">
You can easily handle it by using the DomDocument and DomXPath php classes.
Here is how-to using PHP:
// Your document URL
$url = 'https://issuu.com/proyectotres/docs/proyecto_3_edicion_135';
// Turn off errors, loads the URL as an object and then turn errors on again
libxml_use_internal_errors(true);
$dom = DomDocument::loadHTMLFile($url);
libxml_use_internal_errors(false);
// DomXPath helps find the <meta property="og:video" content="http://hereyoucanfindthedocumentid?documentId=xxxxx-xxxxxxx"/>
$xpath = new DOMXPath($dom);
$meta = $xpath->query("//html/head/meta[#property='og:video']");
// Get the content attribute of the <meta> node and parse its query
$vars = [];
parse_str(parse_url($meta[0]->getAttribute('content'))['query'], $vars);
// Ready. The document ID is here:
$docID = $vars['documentId'];
// You can print it:
echo $docID;
You can try it with the URL of your own Issu document.
You can use the Issuu URL of your document to complete this iframe :
<iframe width="100%" height="283" style="display: block; margin-left: auto; margin-right: auto;" src="https://e.issuu.com/issuu-reader3-embed-files/latest/twittercard.html?u=nantucketchamber&d=program-update1&p=1" frameborder="0" allowfullscreen="allowfullscreen" span="" id="CmCaReT"></iframe>
You just need to replace "nantucketchamber" by a user name and "program-update1" by the file name in the Issuu URL
(for this example the URL is https://issuu.com/nantucketchamber/docs/program-update1)